Comparing Exceptions and Errors

Steven Schveighoffer schveiguy at gmail.com
Sun Jun 5 21:08:11 UTC 2022


On 6/5/22 12:27 PM, Ola Fosheim Grøstad wrote:
> Ok, so I am a bit confused about what is Error and what is not… 
> According to core.exception there is wide array of runtime Errors:
> 
> ```
> RangeError
> ArrayIndexError
> ArraySliceError
> AssertError
> FinalizeError
> OutOfMemoryError
> InvalidMemoryOperationError
> ForkError
> SwitchError
> ```
> 
> I am not sure that any of these should terminate anything outside the 
> offending actor, but I could be wrong as it is hard to tell exactly when 
> some of those are thrown.

Just FYI, this is a *different discussion* from whether Errors should be 
recoverable.

Whether specific conditions are considered an Error or an Exception is 
something on which I have differing opinions than the language.

However, I do NOT have a problem with having an assert/invariant 
mechanism to help prove my program is correct.

-Steve


More information about the Digitalmars-d-learn mailing list