diff options
author | Andrew Dolgov <[email protected]> | 2021-02-23 22:26:07 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2021-02-23 22:26:07 +0300 |
commit | 8d2e3c2528e67f8650c122f014364a34bf690d2a (patch) | |
tree | fd44203c8a5919848f689cb6caa8c0c8d0784d54 /backend.php | |
parent | 37d46411c77bda2b1823f7d230b06e36b7125a8d (diff) |
drop errors.php and simplify error handling
Diffstat (limited to 'backend.php')
-rw-r--r-- | backend.php | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/backend.php b/backend.php index 9bc1449d0..206d866b7 100644 --- a/backend.php +++ b/backend.php @@ -45,7 +45,7 @@ if (!empty($_SESSION["uid"])) { if (!\Sessions\validate_session()) { header("Content-Type: text/json"); - print error_json(6); + print Errors::to_json(Errors::E_UNAUTHORIZED); return; } UserHelper::load_user_plugins($_SESSION["uid"]); @@ -106,7 +106,7 @@ if (strpos($method, "_") === 0) { user_error("Refusing to invoke method $method of handler $op which starts with underscore.", E_USER_WARNING); header("Content-Type: text/json"); - print error_json(6); + print Errors::to_json(Errors::E_UNAUTHORIZED); return; } @@ -130,7 +130,7 @@ } else { user_error("Refusing to invoke method $method of handler $op which has required parameters.", E_USER_WARNING); header("Content-Type: text/json"); - print error_json(6); + print Errors::to_json(Errors::E_UNAUTHORIZED); } } else { if (method_exists($handler, "catchall")) { @@ -141,19 +141,19 @@ return; } else { header("Content-Type: text/json"); - print error_json(6); + print Errors::to_json(Errors::E_UNAUTHORIZED); return; } } else { user_error("Refusing to invoke method $method of handler $op with invalid CSRF token.", E_USER_WARNING); header("Content-Type: text/json"); - print error_json(6); + print Errors::to_json(Errors::E_UNAUTHORIZED); return; } } } header("Content-Type: text/json"); - print error_json(13); + print Errors::to_json(Errors::E_UNKNOWN_METHOD); ?> |