Skip to content

Instantly share code, notes, and snippets.

@ionas
Last active December 29, 2015 15:39
Show Gist options
  • Save ionas/e5ff6a523dc20c8beae1 to your computer and use it in GitHub Desktop.
Save ionas/e5ff6a523dc20c8beae1 to your computer and use it in GitHub Desktop.
CakePHP 3 Service Unavailable Exception HTTP 503
<?php
namespace App\Network\Exception;
use Cake\Network\Exception\HttpException;
/**
* Represents an HTTP 503 error.
*
*/
class ServiceUnavailableException extends HttpException
{
/**
* Constructor
*
* @param string $message If no message is given 'Service Unavailable' will be the message
* @param int $code Status code, defaults to 503
*/
public function __construct($message = null, $code = 503)
{
if (empty($message)) {
$message = 'Service Unavailable';
}
parent::__construct($message, $code);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment