This commit is contained in:
Dominik Picheta
2017-02-01 21:11:40 +01:00
parent e8c46d29cd
commit 3cbfd56e1d
4 changed files with 41 additions and 19 deletions

View File

@@ -25,3 +25,19 @@ Compiler Additions
Language Additions
------------------
- The ``try`` statement's ``except`` branches now support the binding of a
caught exception to a variable:
.. code-block:: nim
try:
raise newException(Exception, "Hello World")
except Exception as exc:
echo(exc.msg)
This replaces the ``getCurrentException`` and ``getCurrentExceptionMsg()``
procedures, although these procedures will remain in the stdlib for the
foreseeable future. This new language feature is actually implemented using
these procedures.
In the near future we will be converting all exception types to refs to
remove the need for the ``newException`` template.