diff options
Diffstat (limited to 'utils/messages.c')
-rw-r--r-- | utils/messages.c | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/utils/messages.c b/utils/messages.c index 5b62912a6..8ae616b86 100644 --- a/utils/messages.c +++ b/utils/messages.c @@ -200,3 +200,99 @@ const char *messages_get(const char *key) { return messages_get_ctx(key, messages_hash); } + + +/** + * lookup of a message by errorcode from the standard Messages hash. + * + * \param code errorcode of message + * \return message text + */ + +const char *messages_get_errorcode(nserror code) +{ + switch (code) { + case NSERROR_OK: + /**< No error */ + return messages_get_ctx("OK", messages_hash); + + case NSERROR_NOMEM: + /**< Memory exhaustion */ + return messages_get_ctx("NoMemory", messages_hash); + + case NSERROR_NO_FETCH_HANDLER: + /**< No fetch handler for URL scheme */ + return messages_get_ctx("NoHandler", messages_hash); + + case NSERROR_NOT_FOUND: + /**< Requested item not found */ + return messages_get_ctx("NotFound", messages_hash); + + case NSERROR_SAVE_FAILED: + /**< Failed to save data */ + return messages_get_ctx("SaveFailed", messages_hash); + + case NSERROR_CLONE_FAILED: + /**< Failed to clone handle */ + return messages_get_ctx("CloneFailed", messages_hash); + + case NSERROR_INIT_FAILED: + /**< Initialisation failed */ + return messages_get_ctx("InitFailed", messages_hash); + + case NSERROR_MNG_ERROR: + /**< An MNG error occurred */ + return messages_get_ctx("MNGError", messages_hash); + + case NSERROR_BAD_ENCODING: + /**< The character set is unknown */ + return messages_get_ctx("BadEncoding", messages_hash); + + case NSERROR_NEED_DATA: + /**< More data needed */ + return messages_get_ctx("NeedData", messages_hash); + + case NSERROR_ENCODING_CHANGE: + /**< The character set encoding change was unhandled */ + return messages_get_ctx("EncodingChanged", messages_hash); + + case NSERROR_BAD_PARAMETER: + /**< Bad Parameter */ + return messages_get_ctx("BadParameter", messages_hash); + + case NSERROR_INVALID: + /**< Invalid data */ + return messages_get_ctx("Invalid", messages_hash); + + case NSERROR_BOX_CONVERT: + /**< Box conversion failed */ + return messages_get_ctx("BoxConvert", messages_hash); + + case NSERROR_STOPPED: + /**< Content conversion stopped */ + return messages_get_ctx("Stopped", messages_hash); + + case NSERROR_DOM: + /**< DOM call returned error */ + return messages_get_ctx("ParsingFail", messages_hash); + + case NSERROR_CSS: + /**< CSS call returned error */ + return messages_get_ctx("CSSGeneric", messages_hash); + + case NSERROR_CSS_BASE: + /**< CSS base sheet failed */ + return messages_get_ctx("CSSBase", messages_hash); + + case NSERROR_BAD_URL: + /**< Bad URL */ + return messages_get_ctx("BadURL", messages_hash); + + default: + case NSERROR_UNKNOWN: + break; + } + + /**< Unknown error */ + return messages_get_ctx("Unknown", messages_hash); +} |