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?