Browse Source

Merge pull request #51791 from mhilbrunner/better-error-names

Improve error descriptions
Max Hilbrunner 4 years ago
parent
commit
0df9895eb7
2 changed files with 54 additions and 49 deletions
  1. 49 49
      core/error/error_list.cpp
  2. 5 0
      core/error/error_list.h

+ 49 - 49
core/error/error_list.cpp

@@ -31,55 +31,55 @@
 #include "error_list.h"
 
 const char *error_names[] = {
-	"No error",
-	"Generic error",
-	"Requested operation is unsupported/unavailable",
-	"The object hasn't been set up properly",
-	"Missing credentials for requested resource",
-	"Parameter out of range",
-	"Out of memory",
-	"File not found",
-	"Bad drive",
-	"Bad path",
-	"Permission denied",
-	"Already in use",
-	"Can't open file",
-	"Can't write file",
-	"Can't read file",
-	"File unrecognized",
-	"File corrupt",
-	"Missing dependencies for file",
-	"Unexpected eof",
-	"Can't open resource/socket/file", // File too? What's the difference to ERR_FILE_CANT_OPEN
-	"Can't create", // What can't be created,
-	"Query failed", // What query,
-	"Already in use",
-	"Resource is locked",
-	"Timeout",
-	"Can't connect",
-	"Can't resolve hostname", // I guessed it's the hostname here.
-	"Connection error",
-	"Can't acquire resource",
-	"Can't fork",
-	"Invalid data",
-	"Invalid parameter",
-	"Item already exists",
-	"Item does not exist",
-	"Can't read from database", // Comments say, it's full? Is that correct?
-	"Can't write to database", // Is the database always full when this is raised?
-	"Compilation failed",
-	"Method not found",
-	"Link failed",
-	"Script failed",
-	"Cyclic link detected",
-	"Invalid declaration",
-	"Duplicate symbol",
-	"Parse error",
-	"Resource is busy",
-	"Skip error", // ???? What's this? String taken from the docs
-	"Help error", // More specific?
-	"Bug",
-	"Printer on fire",
+	"OK", // OK
+	"Failed", // FAILED
+	"Unavailable", // ERR_UNAVAILABLE
+	"Unconfigured", // ERR_UNCONFIGURED
+	"Unauthorized", // ERR_UNAUTHORIZED
+	"Parameter out of range", // ERR_PARAMETER_RANGE_ERROR
+	"Out of memory", // ERR_OUT_OF_MEMORY
+	"File not found", // ERR_FILE_NOT_FOUND
+	"File: Bad drive", // ERR_FILE_BAD_DRIVE
+	"File: Bad path", // ERR_FILE_BAD_PATH
+	"File: Permission denied", // ERR_FILE_NO_PERMISSION
+	"File already in use", // ERR_FILE_ALREADY_IN_USE
+	"Can't open file", // ERR_FILE_CANT_OPEN
+	"Can't write file", // ERR_FILE_CANT_WRITE
+	"Can't read file", // ERR_FILE_CANT_READ
+	"File unrecognized", // ERR_FILE_UNRECOGNIZED
+	"File corrupt", // ERR_FILE_CORRUPT
+	"Missing dependencies for file", // ERR_FILE_MISSING_DEPENDENCIES
+	"End of file", // ERR_FILE_EOF
+	"Can't open", // ERR_CANT_OPEN
+	"Can't create", // ERR_CANT_CREATE
+	"Query failed", // ERR_QUERY_FAILED
+	"Already in use", // ERR_ALREADY_IN_USE
+	"Locked", // ERR_LOCKED
+	"Timeout", // ERR_TIMEOUT
+	"Can't connect", // ERR_CANT_CONNECT
+	"Can't resolve", // ERR_CANT_RESOLVE
+	"Connection error", // ERR_CONNECTION_ERROR
+	"Can't acquire resource", // ERR_CANT_ACQUIRE_RESOURCE
+	"Can't fork", // ERR_CANT_FORK
+	"Invalid data", // ERR_INVALID_DATA
+	"Invalid parameter", // ERR_INVALID_PARAMETER
+	"Already exists", // ERR_ALREADY_EXISTS
+	"Does not exist", // ERR_DOES_NOT_EXIST
+	"Can't read database", // ERR_DATABASE_CANT_READ
+	"Can't write database", // ERR_DATABASE_CANT_WRITE
+	"Compilation failed", // ERR_COMPILATION_FAILED
+	"Method not found", // ERR_METHOD_NOT_FOUND
+	"Link failed", // ERR_LINK_FAILED
+	"Script failed", // ERR_SCRIPT_FAILED
+	"Cyclic link detected", // ERR_CYCLIC_LINK
+	"Invalid declaration", // ERR_INVALID_DECLARATION
+	"Duplicate symbol", // ERR_DUPLICATE_SYMBOL
+	"Parse error", // ERR_PARSE_ERROR
+	"Busy", // ERR_BUSY
+	"Skip", // ERR_SKIP
+	"Help", // ERR_HELP
+	"Bug", // ERR_BUG
+	"Printer on fire", // ERR_PRINTER_ON_FIRE
 };
 
 static_assert(sizeof(error_names) / sizeof(*error_names) == ERR_MAX);

+ 5 - 0
core/error/error_list.h

@@ -36,6 +36,11 @@
  * values can be more detailed in the future.
  *
  * This is a generic error list, mainly for organizing a language of returning errors.
+ *
+ * Errors:
+ * - Are added to the Error enum in core/error/error_list.h
+ * - Have a description added to error_names in core/error/error_list.cpp
+ * - Are bound with BIND_CORE_ENUM_CONSTANT() in core/core_constants.cpp
  */
 
 enum Error {