Clean up some exceptions, phpdoc

This commit is contained in:
Gilles Crettenand
2015-06-02 22:49:44 +02:00
parent af4c9e77c8
commit 5c14ea3127
5 changed files with 104 additions and 32 deletions

View File

@@ -0,0 +1,15 @@
<?php
namespace BSR\Lib\Exception;
/**
* This exception should be raised when an error
* related to the authentication mechanism arise.
*
* @package BSR\Lib\Exception
*/
class AuthenticationException extends WebException {
const USER_NOT_FOUND = 200;
const BAD_LOGIN = 201;
const AUTHENTICATION_FAILED = 202;
}

View File

@@ -2,8 +2,14 @@
namespace BSR\Lib\Exception;
/**
* This exception should be raised when trying to access or
* manipulate a non-existing book.
*
* @package BSR\Lib\Exception
*/
class BookNotFoundException extends WebException {
public function __construct($code) {
parent::__construct('BookNotFound', "The book with code $code was not found", -404);
parent::__construct('BookNotFound', "The book with code $code was not found.", 404);
}
}

View File

@@ -2,4 +2,18 @@
namespace BSR\Lib\Exception;
class UsageException extends WebException {}
/**
* This exception should be raised by the WebService engine when
* there is an error preventing the correct calling of a method.
*
* @package BSR\Lib\Exception
*/
class UsageException extends WebException {
const NO_ARGS = 100;
const MISSING_METHOD = 101;
const BAD_METHOD = 102;
const TOO_FEW_ARGS = 103;
const TOO_MANY_ARGS = 104;
}