From 4cf1e3eb4b77e4afd5047397b05726756c2de598 Mon Sep 17 00:00:00 2001 From: Araq Date: Fri, 10 Aug 2018 15:31:53 +0200 Subject: [PATCH] rename SystemError to CatchableError in order to avoid breaking Nimble and probably lots of other code --- changelog.md | 2 +- doc/manual.rst | 3 ++- lib/system.nim | 8 ++++---- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/changelog.md b/changelog.md index 5a28fc7ffe..f48f7e0248 100644 --- a/changelog.md +++ b/changelog.md @@ -178,7 +178,7 @@ of managing memory. - The exception hierarchy was slightly reworked, ``SystemError`` was renamed to - ``Error`` and is the new base class for any exception that is guaranteed to + ``CatchableError`` and is the new base class for any exception that is guaranteed to be catchable. This change should have minimal impact on most existing Nim code. diff --git a/doc/manual.rst b/doc/manual.rst index 6ce72e2e1d..6ea82b78c0 100644 --- a/doc/manual.rst +++ b/doc/manual.rst @@ -3973,7 +3973,8 @@ Every exception inherits from ``system.Exception``. Exceptions that indicate programming bugs inherit from ``system.Defect`` (which is a subtype of ``Exception``) and are stricly speaking not catchable as they can also be mapped to an operation that terminates the whole process. Exceptions that indicate any other runtime error -that can be caught inherit from ``system.Error`` (which is a subtype of ``Exception``). +that can be caught inherit from ``system.CatchableError`` +(which is a subtype of ``Exception``). Imported exceptions diff --git a/lib/system.nim b/lib/system.nim index 531363eb1a..b92dd58d61 100644 --- a/lib/system.nim +++ b/lib/system.nim @@ -489,18 +489,18 @@ type ## but that are strictly uncatchable as they can also be mapped to ## a ``quit`` / ``trap`` / ``exit`` operation. - Error* = object of Exception ## \ + CatchableError* = object of Exception ## \ ## Abstract class for all exceptions that are catchable. - IOError* = object of Error ## \ + IOError* = object of CatchableError ## \ ## Raised if an IO error occurred. EOFError* = object of IOError ## \ ## Raised if an IO "end of file" error occurred. - OSError* = object of Error ## \ + OSError* = object of CatchableError ## \ ## Raised if an operating system service failed. errorCode*: int32 ## OS-defined error code describing this error. LibraryError* = object of OSError ## \ ## Raised if a dynamic library could not be loaded. - ResourceExhaustedError* = object of Error ## \ + ResourceExhaustedError* = object of CatchableError ## \ ## Raised if a resource request could not be fulfilled. ArithmeticError* = object of Defect ## \ ## Raised if any kind of arithmetic error occurred.