Re: Custom exceptions

2020-04-04 Thread lscrd
OK, thanks. My question was for a catchable error but, indeed, maybe I could use two exceptions in this case, one catchable, the other not catchable.

Re: Custom exceptions

2020-04-04 Thread mratsim
`CatchableError` is good style if it's an exception that can be recovered from. If otherwise it's bug or a situation where execution should be aborted, you should use `Defect`.

Custom exceptions

2020-04-04 Thread lscrd
Hi, Until now, the normal way to create a new exception type was by inheriting from Exception. At least, it was the recommended way in the manual (and is still). In the development version and in the new 1.2 version, this is considered bad style and you get a warning if you inherit from Excepti

Re: Raising custom exceptions and tracking them in proc signatures

2020-03-10 Thread Hlaaftana
You have been asking a lot of questions that are documented clearly in the [manual](https://nim-lang.org/docs/manual.html) and system module . There is also a page listing all the modules in the [standard library](https://nim-lang.org/docs/lib.html) and als

Re: Raising custom exceptions and tracking them in proc signatures

2020-03-10 Thread adnan
nvm I just found this [https://rosettacode.org/wiki/Exceptions#Nim](https://rosettacode.org/wiki/Exceptions#Nim)

Raising custom exceptions and tracking them in proc signatures

2020-03-10 Thread adnan
Hi, as far as I know Nim has exception tracking: proc doRaise() {.raises: [IOError].} = raise newException(IOError, "IO") Run 1\. Where are the common error types like "IOError" defined in the stdlib? 2\. I want to throw a custom exception. How can I annotate the