The Case For Returning Errors Instead of Throwing Them in Typescript
By returning errors, you can statically type them and enforce their structure throughout the application at compile time. This leads to a more robust error handling and reduces the risk of logging sensitive data.
hugonteifeh.com