diff --git a/lib/NGCP/Panel/Role/API.pm b/lib/NGCP/Panel/Role/API.pm index 865781105f..82b76aa6ae 100644 --- a/lib/NGCP/Panel/Role/API.pm +++ b/lib/NGCP/Panel/Role/API.pm @@ -1071,6 +1071,18 @@ sub log_response { $errors = $c->stash->{is_api_error_response} ? join ', ', splice @{$c->error}, 1 : join ', ', @{$c->error}; + + # unhandled error message, should return 500 instead of 200 + if ($c->response->status == 200) { + my $code = HTTP_INTERNAL_SERVER_ERROR; + $c->response->content_type('application/json'); + $c->response->status($code); + $c->response->body(JSON::to_json({ + code => $code, + message => "Internal Server Error" })."\n" + ); + } + $c->clear_errors; } my ($response_body, $params_data) = $self->filter_log_response(