diff options
author | Araq <rumpf_a@web.de> | 2014-11-14 02:20:26 +0100 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2014-11-14 02:20:26 +0100 |
commit | 65ca05730dd91f8a9c2408379415bca19f0c74ba (patch) | |
tree | 133f9261142f74f3498f108e7c2d2d711d7c823e | |
parent | 61c1fd6944c074b4a554a365bd9ce678942dd69e (diff) | |
download | Nim-65ca05730dd91f8a9c2408379415bca19f0c74ba.tar.gz |
onRaise doesn't work as documented as is dubious
-rw-r--r-- | doc/manual/exceptions.txt | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/doc/manual/exceptions.txt b/doc/manual/exceptions.txt index b3727b7cf..7cad1c2b4 100644 --- a/doc/manual/exceptions.txt +++ b/doc/manual/exceptions.txt @@ -99,34 +99,6 @@ re-raise. It follows that the ``raise`` statement *always* raises an exception (unless a raise hook has been provided). -onRaise builtin ---------------- - -`system.onRaise() <system.html#onRaise>`_ can be used to override the -behaviour of ``raise`` for a single ``try`` statement. ``onRaise`` has to be -called within the ``try`` statement that should be affected. - -This allows for a Lisp-like `condition system`:idx:\: - -.. code-block:: nim - var myFile = open("broken.txt", fmWrite) - try: - onRaise do (e: ref Exception)-> bool: - if e of IOError: - stdout.writeln "ok, writing to stdout instead" - else: - # do raise other exceptions: - result = true - myFile.writeln "writing to broken file" - finally: - myFile.close() - -``onRaise`` can only *filter* raised exceptions, it cannot transform one -exception into another. (Nor should ``onRaise`` raise an exception though -this is currently not enforced.) This restriction keeps the exception tracking -analysis sound. - - Exception hierarchy ------------------- |