DEV Community

Discussion on: Say goodbye Trycatch Hell

Collapse
adi518 profile image
Adi Sahar

This matter has been discussed many times. It's better to return the error as the first element to coerce consumers into always handling errors, otherwise it's easy to forget.

Collapse
ivanz123 profile image
Ivan Zadivar Author

In this case, it will be hard to forget, since Typescript is used, so you will know that it is the answer or a null value. Thank you for your comments.