I have script and it sometimes cause 500 Internal Server Error
. I can handle that errors. But which status to use in answer when this occur?
Code example in perl:
# catch error
eval {
here is code which sometimes cause 500
....
$response_body = handle_request();
}
# Check if error occur
if( $@ ) {
$response_body = 'Error was handled';
# Should I change status from 500?
# If I should change. Which status I should use?
# 200 or something else?
}
return $response_body;