You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
classCustomErrorextendsSError{staticdefaultTemplate='there was a problem with foo: {foo}'}error=CustomError.create({foo: 'bar'})// => error.message = 'there was a problem with foo: bar'
Having the message template defined with the error seems to separate responsibilities better: the error message knows how to display the error, and the call-site does not need to know that. Seems to me to better design in some cases, by moving more logic to the error object and away from the call-site.
The text was updated successfully, but these errors were encountered:
It would be nice to call an error like so:
Having the message template defined with the error seems to separate responsibilities better: the error message knows how to display the error, and the call-site does not need to know that. Seems to me to better design in some cases, by moving more logic to the error object and away from the call-site.
The text was updated successfully, but these errors were encountered: