mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-11-02 19:36:08 +01:00
Cleaner error messages
This commit is contained in:
@@ -1052,7 +1052,11 @@ class AdminController extends AdminBaseController
|
|||||||
try {
|
try {
|
||||||
$result = Gpm::install($package, ['theme' => $type === 'theme']);
|
$result = Gpm::install($package, ['theme' => $type === 'theme']);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->admin->json_response = ['status' => 'error', 'message' => $e->getMessage()];
|
$msg = $e->getMessage();
|
||||||
|
$msg = Utils::contains($msg, '401 Unauthorized') ? "ERROR: Authorization failed for this resource" : $msg;
|
||||||
|
$msg = Utils::contains($msg, '404 Not Found') ? "ERROR: Resource not found" : $msg;
|
||||||
|
|
||||||
|
$this->admin->json_response = ['status' => 'error', 'message' => $msg];
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user