Auth0 Home Blog Docs

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



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 is still a quite meaningless 500.
Is it possible to influence the message and status code there too?

See also


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.


Any news on that topic ?



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.