1/**************************************************************************/
2/* error_list.h */
3/**************************************************************************/
4/* This file is part of: */
5/* GODOT ENGINE */
6/* https://godotengine.org */
7/**************************************************************************/
8/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
9/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
10/* */
11/* Permission is hereby granted, free of charge, to any person obtaining */
12/* a copy of this software and associated documentation files (the */
13/* "Software"), to deal in the Software without restriction, including */
14/* without limitation the rights to use, copy, modify, merge, publish, */
15/* distribute, sublicense, and/or sell copies of the Software, and to */
16/* permit persons to whom the Software is furnished to do so, subject to */
17/* the following conditions: */
18/* */
19/* The above copyright notice and this permission notice shall be */
20/* included in all copies or substantial portions of the Software. */
21/* */
22/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
23/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
24/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
25/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
26/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
27/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
28/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
29/**************************************************************************/
30
31#ifndef ERROR_LIST_H
32#define ERROR_LIST_H
33
34/** Error List. Please never compare an error against FAILED
35 * Either do result != OK , or !result. This way, Error fail
36 * values can be more detailed in the future.
37 *
38 * This is a generic error list, mainly for organizing a language of returning errors.
39 *
40 * Errors:
41 * - Are added to the Error enum in core/error/error_list.h
42 * - Have a description added to error_names in core/error/error_list.cpp
43 * - Are bound with BIND_CORE_ENUM_CONSTANT() in core/core_constants.cpp
44 */
45
46enum Error {
47 OK, // (0)
48 FAILED, ///< Generic fail error
49 ERR_UNAVAILABLE, ///< What is requested is unsupported/unavailable
50 ERR_UNCONFIGURED, ///< The object being used hasn't been properly set up yet
51 ERR_UNAUTHORIZED, ///< Missing credentials for requested resource
52 ERR_PARAMETER_RANGE_ERROR, ///< Parameter given out of range (5)
53 ERR_OUT_OF_MEMORY, ///< Out of memory
54 ERR_FILE_NOT_FOUND,
55 ERR_FILE_BAD_DRIVE,
56 ERR_FILE_BAD_PATH,
57 ERR_FILE_NO_PERMISSION, // (10)
58 ERR_FILE_ALREADY_IN_USE,
59 ERR_FILE_CANT_OPEN,
60 ERR_FILE_CANT_WRITE,
61 ERR_FILE_CANT_READ,
62 ERR_FILE_UNRECOGNIZED, // (15)
63 ERR_FILE_CORRUPT,
64 ERR_FILE_MISSING_DEPENDENCIES,
65 ERR_FILE_EOF,
66 ERR_CANT_OPEN, ///< Can't open a resource/socket/file
67 ERR_CANT_CREATE, // (20)
68 ERR_QUERY_FAILED,
69 ERR_ALREADY_IN_USE,
70 ERR_LOCKED, ///< resource is locked
71 ERR_TIMEOUT,
72 ERR_CANT_CONNECT, // (25)
73 ERR_CANT_RESOLVE,
74 ERR_CONNECTION_ERROR,
75 ERR_CANT_ACQUIRE_RESOURCE,
76 ERR_CANT_FORK,
77 ERR_INVALID_DATA, ///< Data passed is invalid (30)
78 ERR_INVALID_PARAMETER, ///< Parameter passed is invalid
79 ERR_ALREADY_EXISTS, ///< When adding, item already exists
80 ERR_DOES_NOT_EXIST, ///< When retrieving/erasing, if item does not exist
81 ERR_DATABASE_CANT_READ, ///< database is full
82 ERR_DATABASE_CANT_WRITE, ///< database is full (35)
83 ERR_COMPILATION_FAILED,
84 ERR_METHOD_NOT_FOUND,
85 ERR_LINK_FAILED,
86 ERR_SCRIPT_FAILED,
87 ERR_CYCLIC_LINK, // (40)
88 ERR_INVALID_DECLARATION,
89 ERR_DUPLICATE_SYMBOL,
90 ERR_PARSE_ERROR,
91 ERR_BUSY,
92 ERR_SKIP, // (45)
93 ERR_HELP, ///< user requested help!!
94 ERR_BUG, ///< a bug in the software certainly happened, due to a double check failing or unexpected behavior.
95 ERR_PRINTER_ON_FIRE, /// the parallel port printer is engulfed in flames
96 ERR_MAX, // Not being returned, value represents the number of errors
97};
98
99extern const char *error_names[];
100
101#endif // ERROR_LIST_H
102