Handling 500 error returned by Endpoint