I've been getting various similar warnings, like:
Warning: See corresponding Defect; DivByZeroError is deprecated [Deprecated]
The same happens with OverflowError which I'm trying to catch in some cases, like:
try:
... something
except OverflowError:
... handle the error
What should I do to (at least) silence it?
oh... and I kept looking and looking for the solution and it was apparently in front of me. haha
Thanks a lot! :)
The idea is that Defect should be programming bugs and non catchable, Errors instead should be catchable exceptions.
From Manual:
Exceptions that indicate programming bugs inherit from system.Defect (which is a subtype of Exception) and are strictly speaking not catchable as they can also be mapped to an operation that terminates the whole process. If panics are turned into exceptions, these exceptions inherit from Defect.
In 1.2 a compiler option was introduced that turns Defects into fatal errors. From Changelog:
The compiler now supports a new switch --panics:on that turns runtime errors like IndexError or OverflowError into fatal errors that cannot be caught via Nim’s try statement. --panics:on can improve the runtime efficiency and code size of your program significantly.
Renaming consistently stdlib to deprecate stuff like OverflowError in favor of OverflowDefect came later than release of 1.2: https://github.com/nim-lang/Nim/pull/13908
Other relevant discussion/reference: