mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-14 21:43:18 +00:00
Add error pages, fix error handling and PHP conf
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
*/
|
||||
|
||||
use Alchemy\Phrasea\Application;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -179,7 +180,7 @@ class API_OAuth2_Account
|
||||
if (! $this->token) {
|
||||
try {
|
||||
$this->token = new API_OAuth2_Token($this->app['phraseanet.appbox'], $this);
|
||||
} catch (Exception_NotFound $e) {
|
||||
} catch (NotFoundHttpException $e) {
|
||||
$this->token = API_OAuth2_Token::create($this->app['phraseanet.appbox'], $this);
|
||||
}
|
||||
}
|
||||
@@ -263,7 +264,7 @@ class API_OAuth2_Account
|
||||
$stmt->closeCursor();
|
||||
|
||||
if (! $row) {
|
||||
throw new Exception_NotFound();
|
||||
throw new NotFoundHttpException('Account nof found.');
|
||||
}
|
||||
|
||||
return new self($app, $row['api_account_id']);
|
||||
|
@@ -10,6 +10,7 @@
|
||||
*/
|
||||
|
||||
use Alchemy\Phrasea\Application;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -149,7 +150,7 @@ class API_OAuth2_Application
|
||||
$stmt->execute(array(':application_id' => $this->id));
|
||||
|
||||
if (0 === $stmt->rowCount()) {
|
||||
throw new \Exception_NotFound(sprintf('Application with id %d not found', $this->id));
|
||||
throw new NotFoundHttpException(sprintf('Application with id %d not found', $this->id));
|
||||
}
|
||||
|
||||
$row = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
@@ -546,7 +547,7 @@ class API_OAuth2_Application
|
||||
$stmt->closeCursor();
|
||||
|
||||
if ( ! $row)
|
||||
throw new Exception_NotFound();
|
||||
throw new NotFoundHttpException('Application not found.');
|
||||
|
||||
return new API_OAuth2_Account($this->app, $row['api_account_id']);
|
||||
}
|
||||
@@ -659,7 +660,7 @@ class API_OAuth2_Application
|
||||
$stmt->closeCursor();
|
||||
|
||||
if ( ! $row)
|
||||
throw new Exception_NotFound();
|
||||
throw new NotFoundHttpException('Client not found.');
|
||||
|
||||
return new self($app, $row['application_id']);
|
||||
}
|
||||
|
@@ -10,6 +10,7 @@
|
||||
*/
|
||||
|
||||
use Alchemy\Phrasea\Application;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -44,7 +45,7 @@ class API_OAuth2_AuthCode
|
||||
$stmt->closeCursor();
|
||||
|
||||
if ( ! $row)
|
||||
throw new Exception_NotFound();
|
||||
throw new NotFoundHttpException('Code not found');
|
||||
|
||||
$this->account_id = (int) $row['api_account_id'];
|
||||
$this->redirect_uri = $row['redirect_uri'];
|
||||
|
@@ -10,6 +10,7 @@
|
||||
*/
|
||||
|
||||
use Alchemy\Phrasea\Application;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -78,7 +79,7 @@ class API_OAuth2_Token
|
||||
$row = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if ( ! $row)
|
||||
throw new Exception_NotFound();
|
||||
throw new NotFoundHttpException('Account not found');
|
||||
|
||||
$stmt->closeCursor();
|
||||
|
||||
@@ -286,7 +287,7 @@ class API_OAuth2_Token
|
||||
$stmt->closeCursor();
|
||||
|
||||
if ( ! $row)
|
||||
throw new Exception_NotFound();
|
||||
throw new NotFoundHttpException('Account not found');
|
||||
|
||||
$account = new API_OAuth2_Account($app, $row['api_account_id']);
|
||||
|
||||
|
Reference in New Issue
Block a user