diff --git a/core/error_list.h b/core/error_list.h
index 304861da4e7..dc5a5e68ddd 100644
--- a/core/error_list.h
+++ b/core/error_list.h
@@ -39,7 +39,7 @@
*/
enum Error {
- OK,
+ OK, // (0)
FAILED, ///< Generic fail error
ERR_UNAVAILABLE, ///< What is requested is unsupported/unavailable
ERR_UNCONFIGURED, ///< The object being used hasn't been properly set up yet
@@ -69,12 +69,12 @@ enum Error {
ERR_CONNECTION_ERROR,
ERR_CANT_ACQUIRE_RESOURCE,
ERR_CANT_FORK,
- ERR_INVALID_DATA, ///< Data passed is invalid (30)
+ ERR_INVALID_DATA, ///< Data passed is invalid (30)
ERR_INVALID_PARAMETER, ///< Parameter passed is invalid
ERR_ALREADY_EXISTS, ///< When adding, item already exists
- ERR_DOES_NOT_EXIST, ///< When retrieving/erasing, it item does not exist
+ ERR_DOES_NOT_EXIST, ///< When retrieving/erasing, if item does not exist
ERR_DATABASE_CANT_READ, ///< database is full
- ERR_DATABASE_CANT_WRITE, ///< database is full (35)
+ ERR_DATABASE_CANT_WRITE, ///< database is full (35)
ERR_COMPILATION_FAILED,
ERR_METHOD_NOT_FOUND,
ERR_LINK_FAILED,
diff --git a/core/global_constants.cpp b/core/global_constants.cpp
index 671b3c545b6..5bfdc8ab8ff 100644
--- a/core/global_constants.cpp
+++ b/core/global_constants.cpp
@@ -486,47 +486,55 @@ void register_global_constants() {
// error list
- BIND_GLOBAL_ENUM_CONSTANT(OK);
- BIND_GLOBAL_ENUM_CONSTANT(FAILED); ///< Generic fail error
- BIND_GLOBAL_ENUM_CONSTANT(ERR_UNAVAILABLE); ///< What is requested is unsupported/unavailable
- BIND_GLOBAL_ENUM_CONSTANT(ERR_UNCONFIGURED); ///< The object being used hasn't been properly set up yet
- BIND_GLOBAL_ENUM_CONSTANT(ERR_UNAUTHORIZED); ///< Missing credentials for requested resource
- BIND_GLOBAL_ENUM_CONSTANT(ERR_PARAMETER_RANGE_ERROR); ///< Parameter given out of range
- BIND_GLOBAL_ENUM_CONSTANT(ERR_OUT_OF_MEMORY); ///< Out of memory
+ BIND_GLOBAL_ENUM_CONSTANT(OK); // (0)
+ BIND_GLOBAL_ENUM_CONSTANT(FAILED);
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_UNAVAILABLE);
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_UNCONFIGURED);
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_UNAUTHORIZED);
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_PARAMETER_RANGE_ERROR); // (5)
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_OUT_OF_MEMORY);
BIND_GLOBAL_ENUM_CONSTANT(ERR_FILE_NOT_FOUND);
BIND_GLOBAL_ENUM_CONSTANT(ERR_FILE_BAD_DRIVE);
BIND_GLOBAL_ENUM_CONSTANT(ERR_FILE_BAD_PATH);
- BIND_GLOBAL_ENUM_CONSTANT(ERR_FILE_NO_PERMISSION);
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_FILE_NO_PERMISSION); // (10)
BIND_GLOBAL_ENUM_CONSTANT(ERR_FILE_ALREADY_IN_USE);
BIND_GLOBAL_ENUM_CONSTANT(ERR_FILE_CANT_OPEN);
BIND_GLOBAL_ENUM_CONSTANT(ERR_FILE_CANT_WRITE);
BIND_GLOBAL_ENUM_CONSTANT(ERR_FILE_CANT_READ);
- BIND_GLOBAL_ENUM_CONSTANT(ERR_FILE_UNRECOGNIZED);
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_FILE_UNRECOGNIZED); // (15)
BIND_GLOBAL_ENUM_CONSTANT(ERR_FILE_CORRUPT);
BIND_GLOBAL_ENUM_CONSTANT(ERR_FILE_MISSING_DEPENDENCIES);
BIND_GLOBAL_ENUM_CONSTANT(ERR_FILE_EOF);
- BIND_GLOBAL_ENUM_CONSTANT(ERR_CANT_OPEN); ///< Can't open a resource/socket/file
- BIND_GLOBAL_ENUM_CONSTANT(ERR_CANT_CREATE);
- BIND_GLOBAL_ENUM_CONSTANT(ERR_PARSE_ERROR);
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_CANT_OPEN);
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_CANT_CREATE); // (20)
BIND_GLOBAL_ENUM_CONSTANT(ERR_QUERY_FAILED);
BIND_GLOBAL_ENUM_CONSTANT(ERR_ALREADY_IN_USE);
- BIND_GLOBAL_ENUM_CONSTANT(ERR_LOCKED); ///< resource is locked
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_LOCKED);
BIND_GLOBAL_ENUM_CONSTANT(ERR_TIMEOUT);
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_CANT_CONNECT); // (25)
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_CANT_RESOLVE);
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_CONNECTION_ERROR);
BIND_GLOBAL_ENUM_CONSTANT(ERR_CANT_ACQUIRE_RESOURCE);
- BIND_GLOBAL_ENUM_CONSTANT(ERR_INVALID_DATA); ///< Data passed is invalid
- BIND_GLOBAL_ENUM_CONSTANT(ERR_INVALID_PARAMETER); ///< Parameter passed is invalid
- BIND_GLOBAL_ENUM_CONSTANT(ERR_ALREADY_EXISTS); ///< When adding ), item already exists
- BIND_GLOBAL_ENUM_CONSTANT(ERR_DOES_NOT_EXIST); ///< When retrieving/erasing ), it item does not exist
- BIND_GLOBAL_ENUM_CONSTANT(ERR_DATABASE_CANT_READ); ///< database is full
- BIND_GLOBAL_ENUM_CONSTANT(ERR_DATABASE_CANT_WRITE); ///< database is full
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_CANT_FORK);
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_INVALID_DATA); // (30)
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_INVALID_PARAMETER);
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_ALREADY_EXISTS);
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_DOES_NOT_EXIST);
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_DATABASE_CANT_READ);
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_DATABASE_CANT_WRITE); // (35)
BIND_GLOBAL_ENUM_CONSTANT(ERR_COMPILATION_FAILED);
BIND_GLOBAL_ENUM_CONSTANT(ERR_METHOD_NOT_FOUND);
BIND_GLOBAL_ENUM_CONSTANT(ERR_LINK_FAILED);
BIND_GLOBAL_ENUM_CONSTANT(ERR_SCRIPT_FAILED);
- BIND_GLOBAL_ENUM_CONSTANT(ERR_CYCLIC_LINK);
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_CYCLIC_LINK); // (40)
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_INVALID_DECLARATION);
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_DUPLICATE_SYMBOL);
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_PARSE_ERROR);
BIND_GLOBAL_ENUM_CONSTANT(ERR_BUSY);
- BIND_GLOBAL_ENUM_CONSTANT(ERR_HELP); ///< user requested help!!
- BIND_GLOBAL_ENUM_CONSTANT(ERR_BUG); ///< a bug in the software certainly happened ), due to a double check failing or unexpected behavior.
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_SKIP); // (45)
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_HELP);
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_BUG);
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_PRINTER_ON_FIRE);
BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_HINT_NONE);
BIND_GLOBAL_ENUM_CONSTANT(PROPERTY_HINT_RANGE);
diff --git a/doc/classes/@GlobalScope.xml b/doc/classes/@GlobalScope.xml
index 1c3b6cba70a..df98048a977 100644
--- a/doc/classes/@GlobalScope.xml
+++ b/doc/classes/@GlobalScope.xml
@@ -1137,127 +1137,160 @@
- Functions that return Error return OK when no error occurred. Most functions don't return errors and/or just print errors to STDOUT.
+ Methods that return [enum Error] return [constant OK] when no error occurred. Note that many functions don't return an error code but will print error messages to stdout.
+ Since [constant OK] has value 0, and all other failure codes are positive integers, it can also be used in boolean checks, e.g.:
+ [codeblock]
+ var err = method_that_returns_error()
+ if (err != OK):
+ print("Failure!)
+ # Or, equivalent:
+ if (err):
+ print("Still failing!)
+ [/codeblock]
Generic error.
- Unavailable error
+ Unavailable error.
- Unconfigured error
+ Unconfigured error.
- Unauthorized error
+ Unauthorized error.
- Parameter range error
+ Parameter range error.
- Out of memory (OOM) error
+ Out of memory (OOM) error.
- File: Not found error
+ File: Not found error.
- File: Bad drive error
+ File: Bad drive error.
- File: Bad path error
+ File: Bad path error.
- File: No permission error
+ File: No permission error.
- File: Already in use error
+ File: Already in use error.
- File: Can't open error
+ File: Can't open error.
- File: Can't write error
+ File: Can't write error.
- File: Can't read error
+ File: Can't read error.
- File: Unrecognized error
+ File: Unrecognized error.
- File: Corrupt error
+ File: Corrupt error.
- File: Missing dependencies error
+ File: Missing dependencies error.
- File: End of file (EOF) error
+ File: End of file (EOF) error.
- Can't open error
+ Can't open error.
- Can't create error
-
-
- Parse error
+ Can't create error.
- Query failed error
+ Query failed error.
- Already in use error
+ Already in use error.
- Locked error
+ Locked error.
- Timeout error
+ Timeout error.
+
+
+ Can't connect error.
+
+
+ Can't resolve error.
+
+
+ Connection error.
- Can't acquire resource error
+ Can't acquire resource error.
+
+
+ Can't fork process error.
- Invalid data error
+ Invalid data error.
- Invalid parameter error
+ Invalid parameter error.
- Already exists error
+ Already exists error.
- Does not exist error
+ Does not exist error.
- Database: Read error
+ Database: Read error.
- Database: Write error
+ Database: Write error.
- Compilation failed error
+ Compilation failed error.
- Method not found error
+ Method not found error.
- Linking failed error
+ Linking failed error.
- Script failed error
+ Script failed error.
- Cycling link (import cycle) error
+ Cycling link (import cycle) error.
+
+
+ Invalid declaration error.
+
+
+ Duplicate symbol error.
+
+
+ Parse error.
- Busy error
+ Busy error.
+
+
+ Skip error.
- Help error
+ Help error.
- Bug error
+ Bug error.
+
+
+ Printer on fire error. (This is an easter egg, no engine methods return this error code.)
No hint for edited property.
diff --git a/modules/gdnative/include/gdnative/gdnative.h b/modules/gdnative/include/gdnative/gdnative.h
index 3c457bf5a7c..884bcf60d28 100644
--- a/modules/gdnative/include/gdnative/gdnative.h
+++ b/modules/gdnative/include/gdnative/gdnative.h
@@ -67,7 +67,7 @@ extern "C" {
////// Error
typedef enum {
- GODOT_OK,
+ GODOT_OK, // (0)
GODOT_FAILED, ///< Generic fail error
GODOT_ERR_UNAVAILABLE, ///< What is requested is unsupported/unavailable
GODOT_ERR_UNCONFIGURED, ///< The object being used hasn't been properly set up yet
@@ -97,12 +97,12 @@ typedef enum {
GODOT_ERR_CONNECTION_ERROR,
GODOT_ERR_CANT_ACQUIRE_RESOURCE,
GODOT_ERR_CANT_FORK,
- GODOT_ERR_INVALID_DATA, ///< Data passed is invalid (30)
+ GODOT_ERR_INVALID_DATA, ///< Data passed is invalid (30)
GODOT_ERR_INVALID_PARAMETER, ///< Parameter passed is invalid
GODOT_ERR_ALREADY_EXISTS, ///< When adding, item already exists
GODOT_ERR_DOES_NOT_EXIST, ///< When retrieving/erasing, it item does not exist
GODOT_ERR_DATABASE_CANT_READ, ///< database is full
- GODOT_ERR_DATABASE_CANT_WRITE, ///< database is full (35)
+ GODOT_ERR_DATABASE_CANT_WRITE, ///< database is full (35)
GODOT_ERR_COMPILATION_FAILED,
GODOT_ERR_METHOD_NOT_FOUND,
GODOT_ERR_LINK_FAILED,