diff options
author | Jacek Sieka <arnetheduck@gmail.com> | 2020-04-28 19:56:01 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-28 19:56:01 +0200 |
commit | 7d6cbf290a5e0cbce14b9926f57221a017f20a4a (patch) | |
tree | f8bf7d55e271571ebbb817ff28858c29e712382b /doc/tut2.rst | |
parent | cd9af6b8040bc72985d457e5169e18ded7c107d6 (diff) | |
download | Nim-7d6cbf290a5e0cbce14b9926f57221a017f20a4a.tar.gz |
Error -> Defect for defects (#13908)
* Error -> Defect for defects The distinction between Error and Defect is subjective, context-dependent and somewhat arbitrary, so when looking at an exception, it's hard to guess what it is - this happens often when looking at a `raises` list _without_ opening the corresponding definition and digging through layers of inheritance. With the help of a little consistency in naming, it's at least possible to start disentangling the two error types and the standard lib can set a good example here.
Diffstat (limited to 'doc/tut2.rst')
-rw-r--r-- | doc/tut2.rst | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/doc/tut2.rst b/doc/tut2.rst index 0338bdb1a..ac8e82b0a 100644 --- a/doc/tut2.rst +++ b/doc/tut2.rst @@ -126,7 +126,7 @@ The syntax for type conversions is ``destination_type(expression_to_convert)`` proc getID(x: Person): int = Student(x).id -The ``InvalidObjectConversionError`` exception is raised if ``x`` is not a +The ``InvalidObjectConversionDefect`` exception is raised if ``x`` is not a ``Student``. @@ -160,7 +160,7 @@ An example: condition, thenPart, elsePart: Node var n = Node(kind: nkFloat, floatVal: 1.0) - # the following statement raises an `FieldError` exception, because + # the following statement raises an `FieldDefect` exception, because # n.kind's value does not fit: n.strVal = "" @@ -388,7 +388,7 @@ The ``try`` statement handles exceptions: let a = readLine(f) let b = readLine(f) echo "sum: ", parseInt(a) + parseInt(b) - except OverflowError: + except OverflowDefect: echo "overflow!" except ValueError: echo "could not convert string to integer" @@ -443,7 +443,7 @@ instance, if you specify that a proc raises ``IOError``, and at some point it prevent that proc from compiling. Usage example: .. code-block:: nim - proc complexProc() {.raises: [IOError, ArithmeticError].} = + proc complexProc() {.raises: [IOError, ArithmeticDefect].} = ... proc simpleProc() {.raises: [].} = |