This repository has been archived on 2024-09-05. You can view files and clone it, but cannot push or open issues or pull requests.
shimmie2/core/exceptions.php

84 lines
1.5 KiB
PHP
Raw Normal View History

2020-01-26 13:19:35 +00:00
<?php declare(strict_types=1);
2014-04-29 05:33:03 +00:00
2009-07-19 07:38:13 +00:00
/**
2014-04-29 05:33:03 +00:00
* Class SCoreException
*
* A base exception to be caught by the upper levels.
2009-07-19 07:38:13 +00:00
*/
2020-01-26 13:19:35 +00:00
class SCoreException extends RuntimeException
{
2020-01-26 13:19:35 +00:00
/** @var string|null */
public $query;
/** @var string */
public $error;
public function __construct(string $msg, ?string $query=null)
{
parent::__construct($msg);
2020-01-26 13:19:35 +00:00
$this->error = $msg;
$this->query = $query;
}
}
2020-01-27 17:47:28 +00:00
class InstallerException extends RuntimeException
{
/** @var string */
public $title;
/** @var string */
public $body;
/** @var int */
public $code;
public function __construct(string $title, string $body, int $code)
{
2020-01-27 19:31:38 +00:00
parent::__construct($title);
2020-01-27 17:47:28 +00:00
$this->title = $title;
$this->body = $body;
$this->code = $code;
}
}
2009-07-19 07:38:13 +00:00
/**
2014-04-29 05:33:03 +00:00
* Class PermissionDeniedException
*
* A fairly common, generic exception.
2009-07-19 07:38:13 +00:00
*/
class PermissionDeniedException extends SCoreException
{
}
2014-04-25 20:07:30 +00:00
/**
* Class ImageDoesNotExist
*
* This exception is used when an Image cannot be found by ID.
*
* Example: Image::by_id(-1) returns null
*/
class ImageDoesNotExist extends SCoreException
{
}
2015-07-12 21:40:28 +00:00
/*
* For validate_input()
*/
class InvalidInput extends SCoreException
{
}
/*
* This is used by the image resizing code when there is not enough memory to perform a resize.
*/
class InsufficientMemoryException extends SCoreException
{
}
2020-01-26 13:19:35 +00:00
/*
* This is used by the image resizing code when there is an error while resizing
*/
class ImageResizeException extends SCoreException
{
2019-06-14 12:47:50 +00:00
}