1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185
<?php
namespace oroboros\core\interfaces\api;
/*
* The MIT License
*
* Copyright 2016 Brian Dayhoff <brian@mopsyd.me>.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
/**
* <Oroboros Exception Code API>
* This interface declares all of the exception codes used by the system. It may
* be implemented to provide easy access to error code levels for checking or throwing
* system compliant exceptions.
* -------------------------------
* If you throwing an exception from a trait,
* you can reference these definitions like so:
*
* throw new \oroboros\core\utilities\exception\Exception("Some error", \oroboros\core\api::EXCEPTION_CODE_GENERAL);
*
* this will insure that all trait exceptions are handled seamlessly,
* even if changes to the exception codes themselves happen in the future.
* If you absolutely must not type that much, put a use/as statement at
* the head of your file like so:
*
*/
interface ExceptionCodeApi extends \oroboros\OroborosInterface {
/**
* This is the default \Exception code,
* so it maps to unknown error. The system will treat all
* uncaught exceptions with status code 0 as FATAL ERRORS.
*/
const ERROR_UNKNOWN = 0;
/**
* <Note about extending this api>
* Range 0-49999 is reserved for HTTP Status codes.
* They don't go that high, but the spec may change
* in the future, so there is room for error
* when integrating new class types.
* @see \oroboros\core\api\ExceptionCodeApi
*/
/**
* <Safe 3rd Party Code Range>
* Oroboros core (and authorized extensions)
* will never claim an error code above this number.
*
* If you want to extend this API with your own codes, they should be
* higher than this number to avoid system collisions, which might produce
* really strange bugs or inaccurate error reporting if you are also using
* the system provided exceptions.
*
* Package validation will fail your package build if this occurs.
* (meaning you have provided custom error codes within the reserved range)
*
* Collisions with other 3rd party extensions cannot be guaranteed, so try to
* pick an error range that you know isn't used elsewhere.
*
* Anything above the below value will not collide with the core system.
*/
const SAFE_MINIMUM_ERROR_RANGE = 50000;
/**
* Most of the following will get chunked out into their own api's.
* @todo migrate individual error apis
*/
/**
* Generic Oroboros core errors.
* ----------------
* These represent errors in the oroboros core class structure.
*/
const ERROR_CORE = 10000; //Generic Oroboros core errors.
const ERROR_CORE_LIBRARY_FAILURE = 10100; //Generic Oroboros core errors.
const ERROR_CORE_CONTROLLER_FAILURE = 10200; //Generic Oroboros core errors.
const ERROR_CORE_MODEL_FAILURE = 10300; //Generic Oroboros core errors.
const ERROR_CORE_VIEW_FAILURE = 10400; //Generic Oroboros core errors.
const ERROR_CORE_ADAPTER_FAILURE = 10500; //Generic Oroboros core errors.
const ERROR_CORE_AUTH_FAILURE = 10600; //Generic Oroboros core errors.
const ERROR_CORE_MODULE_FAILURE = 10700; //Generic Oroboros core errors.
const ERROR_CORE_EXTENSION_FAILURE = 10800; //Generic Oroboros core errors.
const ERROR_CORE_PARSER_FAILURE = 10900; //Generic Oroboros core errors.
const ERROR_CORE_RECORD_FAILURE = 11000; //Generic Oroboros core errors.
const ERROR_CORE_STREAM_FAILURE = 11100; //Generic Oroboros core errors.
const ERROR_CORE_SERVICE_FAILURE = 11200; //Generic Oroboros core errors.
const ERROR_CORE_RESPONSE_FAILURE = 11300; //Generic Oroboros core errors.
const ERROR_CORE_REQUEST_FAILURE = 11400; //Generic Oroboros core errors.
const ERROR_CORE_ROUTER_FAILURE = 11500; //Generic Oroboros core errors.
const ERROR_CORE_UTILITY_FAILURE = 11600; //Generic Oroboros core errors.
const ERROR_CORE_JOB_FAILURE = 11700; //Generic Oroboros core errors.
const ERROR_CORE_ENTITY_FAILURE = 11800; //Generic Oroboros core errors.
const ERROR_CORE_PATTERN_FAILURE = 11900; //Generic Oroboros core errors.
const ERROR_CORE_ROUTINE_FAILURE = 12000; //Generic Oroboros core errors.
const ERROR_CORE_EVENT_FAILURE = 12100; //Generic Oroboros core errors.
const ERROR_CORE_FUNCTION_FAILURE = 12200; //Generic Oroboros core errors.
const ERROR_CORE_ERROR_FAILURE = 12300; //Generic Oroboros core errors.
const ERROR_CORE_FLAG_FAILURE = 12400; //Generic Oroboros core errors.
const ERROR_CORE_ENUM_FAILURE = 12500; //Generic Oroboros core errors.
const ERROR_CORE_DATA_OBJECT_FAILURE = 12600; //Generic Oroboros core errors.
const ERROR_CORE_BOOTSTRAP_FAILURE = 12700; //Generic Oroboros core errors.
/**
* PHP Errors
* ----------------
* Generic or expected errors that can't be handled,
*/
const ERROR_PHP = 11000; //PHP Errors, vanilla exceptions that can't be resolved, etc.
const ERROR_PHP_METHOD_FAILURE = 11001; //Method Failure.
const ERROR_PHP_INSTANTIATION_FAILURE = 11002; //Instantiation Failure.
const ERROR_PHP_DESTRUCTOR_FAILURE = 11003; //Destruct Failure.
const ERROR_PHP_BAD_PARAMETERS = 11004; //Bad parameters.
const ERROR_PHP_BAD_METHOD_CALL = 11005; //Bad method call.
const ERROR_PHP_BAD_FUNCTION_CALL = 11006; //Bad function call.
const ERROR_PHP_WRONG_INSTANCE_SUPPLIED = 11007; //Wrong instance passed.
const ERROR_PHP_WRONG_SCHEMA_PROVIDED = 11008; //Wrong schema provided (Missing expected keys in array, etc).
const ERROR_PHP_NOT_INITIALIZED = 11009; //Not initialized.
const ERROR_PHP_INVOCATION_FAILURE = 11010; //Invocation failed.
const ERROR_PHP_CALL_FAILURE = 11011; //Call failed.
const ERROR_PHP_CLONE_FAILURE = 11012; //Clone failed.
const ERROR_PHP_SERIALIZATION_FAILURE = 11013; //Serialization failed.
const ERROR_PHP_UNSERIALIZATION_FAILURE = 11014; //Unserialization failed.
const ERROR_PHP_SLEEP_FAILURE = 11015; //Sleep failed.
const ERROR_PHP_WAKEUP_FAILURE = 11016; //Wakeup failed.
const ERROR_PHP_GETTER_FAILURE = 11017; //Get failed.
const ERROR_PHP_SETTER_FAILURE = 11018; //Set failed.
const ERROR_PHP_TO_ARRAY_FAILURE = 11019; //To Array failed. Placeholder for if the language ever supports this, and may be used through internal abstraction.
const ERROR_PHP_CALLSTATIC_FAILURE = 11020; //CallStatic failed.
const ERROR_PHP_IS_SET_FAILURE = 11021; //IsSet failed.
const ERROR_PHP_UN_SET_FAILURE = 11022; //UnSet failed.
const ERROR_PHP_DEBUG_INFO_FAILURE = 11023; //DebugInfo failed.
const ERROR_PHP_KEY_NOT_FOUND = 11024; //DebugInfo failed.
const ERROR_FILESYSTEM = 12000; //Filesystem Error - Any issues arising from file access, missing resources, etc.
const ERROR_DATABASE = 13000; //Database Error - A database error. These can range from trivial to very, very bad. Check the log if you see these.
const ERROR_SESSION = 14000; //Session Error - A session mismatch. May occur either due to the server or the client. Usually aggravating, but not serious.
const ERROR_SECURITY = 15000; //Security Error - An error with a security protocol. Usually thrown because of an intentional, malicious attempt to break things by a 3rd party.
const ERROR_SECURITY_LOCKED_RESOURCE = 15100; //Security Error - An attempt was made to access a locked resource in the codebase.
const ERROR_SECURITY_LOCKED_FILE = 15110; //Security Error - An attempt was made to access a locked resource in the filebase.
const ERROR_SECURITY_LOCKED_TABLE = 15120; //Security Error - An attempt was made to access a locked table in the database.
const ERROR_SECURITY_LOCKED_COLUMN = 15121; //Security Error - An attempt was made to access a locked column in the database.
const ERROR_SECURITY_LOCKED_OBJECT = 15122; //Security Error - An attempt was made to access a locked object.
const ERROR_SECURITY_LOCKED_EVENT = 15123; //Security Error - An attempt was made to access a locked event.
const ERROR_SECURITY_LOCKED_ENTITY = 15124; //Security Error - An attempt was made to access a locked entity.
const ERROR_SECURITY_LOCKED_JOB = 15125; //Security Error - An attempt was made to access a locked job.
const ERROR_SECURITY_LOCKED_POLICY = 15126; //Security Error - An attempt was made to access a locked policy.
const ERROR_SECURITY_LOCKED_ROUTE = 15127; //Security Error - An attempt was made to access a locked route.
const ERROR_SECURITY_LOCKED_COMMAND = 15128; //Security Error - An attempt was made to access a locked command.
const ERROR_ROUTING = 16000; //Routing Error - An error with DNS resolution. This means a request was made for something that doesn't exist, or that resource pointers are wrong.
const ERROR_LOGIC = 17000; //Logic Error - An error generated from sloppy programming logic, like infinite recursion or dividing by zero. These should usually be anticipated and handled before they happen, and indicate that a patch is needed.
const ERROR_LOGIC_BAD_PARAMETERS = 17001; //Logic Error - A parameter was supplied, but is malformed.
const ERROR_LOGIC_MISSING_PARAMETERS = 17002; //Logic Error - A required parameter was not supplied.
const ERROR_INITIALIZATION = 18000; //Initialization Error - An error with initialization/bootstrap.
const ERROR_INSTALLATION = 19000; //Installation Error - An error with initial setup. These are very bad.
const ERROR_MODEL = 20000; //Model Error - Any error that cannot be handled by a model. These are bad.
const ERROR_VIEW = 21000; //View Error - Any error in output logic.
const ERROR_LIBRARY = 22000; //Controller Error - An error in a library.
const ERROR_CONTROLLER = 22000; //Controller Error - An error in the controller.
const ERROR_ADAPTER = 23000; //Adapter Error - Any error with an adapter used for interfacing with other resources.
const ERROR_MODULE = 24000; //Module Error - Any error from a 3rd party module
const ERROR_ROUTINE = 25000; //Routine Error - An error generated while running a procedural routine.
const ERROR_SDK = 26000; //SDK Error - Any error generated from a remote 3rd party service returning bad results.
const ERROR_NETWORK = 27000; //RESERVED FOR EXPANSION
const ERROR_CLUSTER = 28000; //RESERVED FOR EXPANSION
const ERROR_NODE = 29000; //RESERVED FOR EXPANSION
}