From 6dae9f5c3600eddaa2b924d76cb09c33b45eaaea Mon Sep 17 00:00:00 2001 From: Max Hilbrunner Date: Tue, 17 Aug 2021 13:51:20 +0200 Subject: [PATCH] Improve error descriptions --- core/error/error_list.cpp | 98 +++++++++++++++++++-------------------- core/error/error_list.h | 5 ++ 2 files changed, 54 insertions(+), 49 deletions(-) diff --git a/core/error/error_list.cpp b/core/error/error_list.cpp index a8355065fe8..e1e94dd65df 100644 --- a/core/error/error_list.cpp +++ b/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); diff --git a/core/error/error_list.h b/core/error/error_list.h index e7c7f10265d..852825dda59 100644 --- a/core/error/error_list.h +++ b/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 {