From 79ee6c04e83cffbcf06e8e58d208ee2e0de5d886 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Sun, 30 Aug 2020 07:49:24 +0300 Subject: [PATCH] Updated error message --- app/controllers/api/database.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/controllers/api/database.php b/app/controllers/api/database.php index 548905edae..b455106bda 100644 --- a/app/controllers/api/database.php +++ b/app/controllers/api/database.php @@ -66,7 +66,7 @@ App::post('/v1/database/collections') 'rules' => $parsedRules, ]); } catch (AuthorizationException $exception) { - throw new Exception('Unauthorized action', 401); + throw new Exception('Unauthorized permissions', 401); } catch (StructureException $exception) { throw new Exception('Bad structure. '.$exception->getMessage(), 400); } catch (\Exception $exception) { @@ -266,7 +266,7 @@ App::put('/v1/database/collections/:collectionId') 'rules' => $parsedRules, ])); } catch (AuthorizationException $exception) { - throw new Exception('Unauthorized action', 401); + throw new Exception('Unauthorized permissions', 401); } catch (StructureException $exception) { throw new Exception('Bad structure. '.$exception->getMessage(), 400); } catch (\Exception $exception) { @@ -404,7 +404,7 @@ App::post('/v1/database/collections/:collectionId/documents') $authorization = new Authorization($parentDocument, 'write'); if (!$authorization->isValid($new->getPermissions())) { - throw new Exception('Unauthorized action', 401); + throw new Exception('Unauthorized permissions', 401); } $parentDocument @@ -429,7 +429,7 @@ App::post('/v1/database/collections/:collectionId/documents') try { $data = $projectDB->createDocument($data); } catch (AuthorizationException $exception) { - throw new Exception('Unauthorized action', 401); + throw new Exception('Unauthorized permissions', 401); } catch (StructureException $exception) { throw new Exception('Bad structure. '.$exception->getMessage(), 400); } catch (\Exception $exception) { @@ -624,7 +624,7 @@ App::patch('/v1/database/collections/:collectionId/documents/:documentId') try { $data = $projectDB->updateDocument($data); } catch (AuthorizationException $exception) { - throw new Exception('Unauthorized action', 401); + throw new Exception('Unauthorized permissions', 401); } catch (StructureException $exception) { throw new Exception('Bad structure. '.$exception->getMessage(), 400); } catch (\Exception $exception) { @@ -680,7 +680,7 @@ App::delete('/v1/database/collections/:collectionId/documents/:documentId') try { $projectDB->deleteDocument($documentId); } catch (AuthorizationException $exception) { - throw new Exception('Unauthorized action', 401); + throw new Exception('Unauthorized permissions', 401); } catch (StructureException $exception) { throw new Exception('Bad structure. '.$exception->getMessage(), 400); } catch (\Exception $exception) {