mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-21 06:45:27 +00:00
Fixes #3691.
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user