Rev 1275 | Rev 1277 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1275 | Rev 1276 | ||
---|---|---|---|
Line 55... | Line 55... | ||
55 | } |
55 | } |
56 | } |
56 | } |
57 | if ($json_out === false) { |
57 | if ($json_out === false) { |
58 | throw new OIDplusException(_L('REST endpoint not found'), null, 404); |
58 | throw new OIDplusException(_L('REST endpoint not found'), null, 404); |
59 | } |
59 | } |
- | 60 | if (!isset($json_out['status'])) $json_out['status'] = -1; // status -1 and -2 like in ajax.php |
|
- | 61 | if (!isset($json_out['status_bits'])) $json_out['status_bits'] = []; |
|
60 | } catch (\Exception $e) { |
62 | } catch (\Exception $e) { |
61 | http_response_code($e instanceof OIDplusException ? $e->getHttpStatus() : 500); |
63 | http_response_code($e instanceof OIDplusException ? $e->getHttpStatus() : 500); |
62 | $json_out = array("status" => -1, "error" => $e->getMessage()); |
64 | $json_out = array("status" => -2, "status_bits" => [], "error" => $e->getMessage()); |
63 | } |
65 | } |
64 | 66 | ||
65 | OIDplus::invoke_shutdown(); |
67 | OIDplus::invoke_shutdown(); |
66 | @header('Content-Type:application/json; charset=utf-8'); |
68 | @header('Content-Type:application/json; charset=utf-8'); |
67 | echo json_encode($json_out); |
69 | echo json_encode($json_out); |