<?php
namespace Lia;
class Exception extends \Exception {
const VIEW_NOT_FOUND = "View '%s' has not been added to Liaison.";
const CANNOT_COPY_NONEXISTENT_VIEW_NS = "Cannot change '%s' view namespace to '%s', because the original namespace does not exist.";
const CANNOT_OVERWRITE_EXISTING_VIEW = "Cannot override view '%s' with the same-named view from namespace '%s'";
const ONLY_ONE_VIEW_LOADED_HOOK_ALLOWED = "Only one view loaded hook is allowed.";
const REQUEST_TARGET_NOT_HANDLED = "Url %s was requested and matched a route, but target could not be resolved. \nTarget is `%s`";
const ADDON_NOT_SET = "Addon with fully qualified name '%s' has not been added. Available addons are: %s";
const PACKAGE_NOT_SET = "Package with fully qualified name '%s' has not been added. Available packages are: %s";
const ADDON_NOT_SET_FROM = "Addon with class '%s' and fqn '%s' is not available on the passed-in Liaison instance. Available addons are: %s";
const ADDON_MUST_DECLARE_FQN = "Every addon MUST declare `public string \$fqn = 'fqn'`, where fqn SHOULD be like `vendor:package.addon_name`. Addon with class '%s' did not declare fqn.";
const FILE_NOT_EXIST = "File '%s' does not exist";
const FILETYPE_UNKNOWN = "Cannot determine file type from path '%s', so cannot get content type headers.";
const INTERNAL_ROUTING_ERROR = "Internal error. We were unable to perform routing for '%s'.";
const ONLY_ONE_PATTERNS_LOADED_HOOK = "Only one hook may be registered to '".\Lia\Hooks::PACKAGE_ROUTE_PATTERNS_LOADED."'. %s were registered.";
const CACHE_DIR_NOT_EXIST = "The cache directory '%s' does not exist, thus cannot be checked for stale files.";
const ROUTES_NOT_FOUND = "No routes were found for this request to `%s`";
const INVALID_RESOURCE_EXTENSION = "Only js and css are allowed at this time, but '%s' was given.";
const ERROR_GOTO_MESSAGE_NOT_AVAILABLE = "Error::goto message is not yet setup";
const MUST_CONFIGURE_FIRST = "Lia::configure() MUST be called BEFORE any packages or addons are added.";
const CONFIGURABLE_ADDON_NOT_FOUND = "Addon '%s' does not exist on package '%s', so it cannot be configured. Available addons are: %s.";
const CANNOT_SET_CONFIG = "Cannot set config '%s' on addon '%s' of class '%s'. Exception Message: %s";
const CSRF_VALUE_NOT_FOUND = "CSRF Value not set to session for key '%s'";
const CSRF_SESSION_NOT_STARTED = "Failed to start session. Cannot do csrf without session.";
const CSRF_TOKEN_NOT_SUBMITTED = "The submitted form data did not contain a csrf token identified by name '%s'";
const CSRF_TOKEN_NOT_IN_SESSION = "A CSRF Token for form_id '%s' was submitted, but was not found in the user's session.";
const CSRF_TOKEN_EXPIRED = "A CSRF Token for form_id '%s' was submitted and was present in the session, but the token had expired.";
const CSRF_TOKEN_MISMATCH = "A CSRF entry for form_id '%s' was present in the session (session[session_key][token]) but the value of the token (session[session_key][token]['value']) did not match the token. This should never happen, and is likely a bug in the CSRF class.";
const CSRF_FORMID_MISMATCH = "A CSRF entry for form_id '%s' was present in the session (session[session_key][token]) but the CSFR Token's stored form id (session[session_key][token]['form_id']) did not match. This should never happen, and is likely a bug in the CSRF class.";
const CSRF_PATH_INCORRECT = "CSRF Token Path mismatch for form id '%s'. Expected path: '%s'. Requested path: '%s'";
const CSRF_NO_REFERER = "CSRF Token submitted, but there is no HTTP_REFERER header. Form id '%s', Requested Path: '%s'";
const CSRF_REFERER_HOST_MISMATCH = "CSRF Token submitted, but http_referer id not match http_host. Form id '%s'. Requested path '%s'. HTTP_REFERER '%s'. HTTP_HOST '%s'.";
const CSRF_HTTPHOST_NOT_SET = "Cannot validate CSRF token because \$SERVER['HTTP_HOST'] is not set or is empty. This is likely a server configuration issue.";
/**
* @param $exception_message should be a message named on this class
* @param $strings as will be passed to sprintf()
*/
public function __construct(string $exception_message, ...$strings){
$full_message = sprintf($exception_message,...$strings);
parent::__construct($full_message);
}
}