Skip to content

Commit abe418d

Browse files
author
Alistair Kearney
committed
Updated ExceptionHandler to check for overloaded http response code. Calls the method getHttpStatusCode() if it is available
1 parent f96fd85 commit abe418d

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/Lib/ExceptionHandler.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,12 @@ private static function getDatabaseTrace($queries){
7272
public static function render($e)
7373
{
7474
// Set some headers
75-
http_response_code(500);
75+
if($e instanceof AbstractApiException) {
76+
http_response_code($e->getHttpStatusCode());
77+
} else {
78+
http_response_code(500);
79+
}
80+
7681
header("Content-Type: application/json");
7782

7883
// Build the JSON

0 commit comments

Comments
 (0)