Auth0 Home Blog Docs

How to return meaningful error after pre-user registration hook fail?

signup
hooks
error
registration
pre-user-registratio

#1

Within an pre-user registration hook I perform checks that can result in user registration denial. In this case the hook throws an error:

const error = new Error("message');
error.statusCode = 400;
return cb(error);

The testrunners returns the correct result, however, the error given back as response to the request to https://my-account.auth0.com/dbconnections/signup is still a quite meaningless 500.
Is it possible to influence the message and status code there too?

See also


#2

At this time there’s no support to propagate the exact error message and code all the way from the hook to the top-level API, in this case /dbconnections/signup. This is a gap that already has been identified and discussed, but for now I can’t provide a definitive timeline for it’s availability.


#3

Any news on that topic ?

Markus


#4

I’m afraid not, it’s still listed in the backlog so there’s no additional information I can share besides what is already in the answer.


#5