Auth0 Home Blog Docs

Custom error in rules

auth0
rules

#1

For returning an error, in examples, new UnauthorizedError(“A message here”) is returned. Which is returned to my SPA as { error: “unauthorized”, errorDescription: “A message here” }.

Is it possible to have a custom error, so it will return something like { error: “custom_error”, errorDescription: “A message here” }?

If not, then is it possible to attach some data to the error?


#2

Have you looked at our docs?


#3

Hey, seems like what I need, thanks!