Add error pages, fix error handling and PHP conf

This commit is contained in:
Romain Neutron
2013-06-14 20:35:39 +02:00
parent 09c6361475
commit 42db38d055
140 changed files with 1962 additions and 1218 deletions

View File

@@ -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']);

View File

@@ -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']);
}

View File

@@ -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'];

View File

@@ -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']);