DEV Community

Discussion on: Errors Are Not Exceptions

Collapse
 
stereobooster profile image
stereobooster

You may be interested in how Pony handles errors

An error is raised with the command error. At any point, the code may decide to declare an error has occurred. Code execution halts at that point, and the call chain is unwound until the nearest enclosing error handler is found. This is all checked at compile time so errors cannot cause the whole program to crash.

They look like exceptions (try/catch), but they are not. Because you can't actually use exception as value which carries message.

Also this maybe interesting (this is about Go): Rob Pike Reinvented Monads

In JS/TS we also have errors as values (idea copied from Monads in Haskell): io-ts.

Collapse
 
olexandrpopov profile image
Oleksandr Popov

You also might be interested in Either monad from fp-ts library.

Collapse
 
devinrhode2 profile image
Devin Rhode

@olexandrpopov, your Either link is broken, new url is:
rlee.dev/practical-guide-to-fp-ts-...

Thread Thread
 
devinrhode2 profile image
Devin Rhode

The import cost of this is insane. More code than an mui Box component!
Image description