Open martinheidegger opened 7 years ago
Can you give an example of what a clean error message would look like from the client perspective?
A lamda function like this:
callback(null, {
statusCode: 200,
body: JSON.stringify({
errors: [
'phoneNumber is not a valid phoneNumber'
]
})
})
stops the execution and shows different outputs depending if I am logged-in as admin user or regularily:
Regular: {errors: ['phoneNumber is not a valid phoneNumber']
Logged-in:
{
errors: ['phoneNumber is not a valid phoneNumber'],
errorLocation: 'pre-hook-0'
}
for debugging.
Currently the only way I can see
pre-hooks
(logic) to prevent continued processing is by returning a non-200 error code. However this will result in a ugly error messages shown in the client of the user. It would be nice to have a way to cleanly return error messages (i.e. with validation errors)