Skip to content

Commit

Permalink
feat: respond http 500 when API error occurs (merge pull request #195
Browse files Browse the repository at this point in the history
…from gnh1201/main)

Response HTTP 500 when API error
  • Loading branch information
Ahwxorg authored Nov 14, 2024
2 parents f6ec8b1 + 43ae649 commit baffa41
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions api.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
}

$results = fetch_search_results($opts, false);
if (array_key_exists("error", $results)) {
http_response_code(500);
}
header("Content-Type: application/json");
echo json_encode($results);
?>

0 comments on commit baffa41

Please sign in to comment.