public function testGetErrorArray() { $errors = $this->_e->getErrorArray(); $this->assertArrayHasKey('errors', $errors); $this->assertEquals(3, count($errors['errors'][0])); $this->assertEquals("You shouldna been doin' that", $errors['errors'][0]['message']); $this->assertEquals('Frapi_Exception_Whatever', $errors['errors'][0]['name']); $this->assertEquals('In yo face!', $errors['errors'][0]['at']); }
/** * Constructor * * This constructs a Frapi_Error message to return to the users. * * @todo add some doc examples of the new errors. * * @param string $error_name Name of error. * @param string $error_msg The actual message of the error. * @param int $http_code This might be hard to grasp however, we are in a web * industry dealing with the web. The code you are sending * to your exception should really be represented by the * HTTP Code returned to your users. * * @return void */ public function __construct($error_name, $error_msg = false, $http_code = false) { if ($error_name instanceof Exception) { $error = self::_get($error_name->getCode(), $error_name->getMessage(), 400); } else { $error = self::_get($error_name, $error_msg, $http_code); } parent::__construct($error['message'], $error['name'], $error['http_code']); }
/** * Constructor * * This constructs a Frapi_Error message to return to the users. * * @todo add some doc examples of the new errors. * * @param string $error_name Name of error. * @param string $error_msg The actual message of the error. * @param int $http_code This might be hard to grasp however, we are in a web * industry dealing with the web. The code you are sending * to your exception should really be represented by the * HTTP Code returned to your users. * * @return void */ public function __construct($error_name, $error_msg = false, $http_code = null) { $error = self::_get($error_name, $error_msg, $http_code); parent::__construct($error['message'], $error['name'], $error['http_code']); }