|
@@ -57,9 +57,6 @@ enum ErrorHandlerType {
|
|
|
|
|
|
class String;
|
|
|
typedef void (*ErrorHandlerFunc)(void *, const char *, const char *, int p_line, const char *, const char *, ErrorHandlerType p_type);
|
|
|
-void _err_set_last_error(const char *p_err);
|
|
|
-void _err_set_last_error(const String &p_err);
|
|
|
-void _err_clear_last_error();
|
|
|
|
|
|
struct ErrorHandlerList {
|
|
|
|
|
@@ -96,29 +93,6 @@ void _err_print_index_error(const char *p_function, const char *p_file, int p_li
|
|
|
|
|
|
/** An index has failed if m_index<0 or m_index >=m_size, the function exits */
|
|
|
|
|
|
-extern bool _err_error_exists;
|
|
|
-
|
|
|
-#ifdef DEBUG_ENABLED
|
|
|
-/** Print a warning string.
|
|
|
- */
|
|
|
-#define ERR_EXPLAINC(m_reason) \
|
|
|
- { \
|
|
|
- _err_set_last_error(m_reason); \
|
|
|
- _err_error_exists = true; \
|
|
|
- }
|
|
|
-#define ERR_EXPLAIN(m_string) \
|
|
|
- { \
|
|
|
- _err_set_last_error(m_string); \
|
|
|
- _err_error_exists = true; \
|
|
|
- }
|
|
|
-
|
|
|
-#else
|
|
|
-
|
|
|
-#define ERR_EXPLAIN(m_text)
|
|
|
-#define ERR_EXPLAINC(m_text)
|
|
|
-
|
|
|
-#endif
|
|
|
-
|
|
|
#ifdef __GNUC__
|
|
|
//#define FUNCTION_STR __PRETTY_FUNCTION__ - too annoying
|
|
|
#define FUNCTION_STR __FUNCTION__
|
|
@@ -145,7 +119,6 @@ extern bool _err_error_exists;
|
|
|
_err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size)); \
|
|
|
return; \
|
|
|
} \
|
|
|
- _err_error_exists = false; \
|
|
|
} while (0); // (*)
|
|
|
|
|
|
#define ERR_FAIL_INDEX_MSG(m_index, m_size, m_msg) \
|
|
@@ -154,7 +127,6 @@ extern bool _err_error_exists;
|
|
|
_err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size), m_msg); \
|
|
|
return; \
|
|
|
} \
|
|
|
- _err_error_exists = false; \
|
|
|
} while (0); // (*)
|
|
|
|
|
|
/** An index has failed if m_index<0 or m_index >=m_size, the function exits.
|
|
@@ -168,7 +140,6 @@ extern bool _err_error_exists;
|
|
|
_err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size)); \
|
|
|
return m_retval; \
|
|
|
} \
|
|
|
- _err_error_exists = false; \
|
|
|
} while (0); // (*)
|
|
|
|
|
|
#define ERR_FAIL_INDEX_V_MSG(m_index, m_size, m_retval, m_msg) \
|
|
@@ -177,7 +148,6 @@ extern bool _err_error_exists;
|
|
|
_err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size), m_msg); \
|
|
|
return m_retval; \
|
|
|
} \
|
|
|
- _err_error_exists = false; \
|
|
|
} while (0); // (*)
|
|
|
|
|
|
/** An index has failed if m_index >=m_size, the function exits.
|
|
@@ -191,7 +161,6 @@ extern bool _err_error_exists;
|
|
|
_err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size)); \
|
|
|
return m_retval; \
|
|
|
} \
|
|
|
- _err_error_exists = false; \
|
|
|
} while (0); // (*)
|
|
|
|
|
|
#define ERR_FAIL_UNSIGNED_INDEX_V_MSG(m_index, m_size, m_retval, m_msg) \
|
|
@@ -200,7 +169,6 @@ extern bool _err_error_exists;
|
|
|
_err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size), m_msg); \
|
|
|
return m_retval; \
|
|
|
} \
|
|
|
- _err_error_exists = false; \
|
|
|
} while (0); // (*)
|
|
|
|
|
|
/** Use this one if there is no sensible fallback, that is, the error is unrecoverable.
|
|
@@ -232,7 +200,6 @@ extern bool _err_error_exists;
|
|
|
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Parameter ' " _STR(m_param) " ' is null."); \
|
|
|
return; \
|
|
|
} \
|
|
|
- _err_error_exists = false; \
|
|
|
}
|
|
|
|
|
|
#define ERR_FAIL_NULL_MSG(m_param, m_msg) \
|
|
@@ -241,7 +208,6 @@ extern bool _err_error_exists;
|
|
|
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Parameter ' " _STR(m_param) " ' is null.", m_msg); \
|
|
|
return; \
|
|
|
} \
|
|
|
- _err_error_exists = false; \
|
|
|
}
|
|
|
|
|
|
#define ERR_FAIL_NULL_V(m_param, m_retval) \
|
|
@@ -250,7 +216,6 @@ extern bool _err_error_exists;
|
|
|
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Parameter ' " _STR(m_param) " ' is null."); \
|
|
|
return m_retval; \
|
|
|
} \
|
|
|
- _err_error_exists = false; \
|
|
|
}
|
|
|
|
|
|
#define ERR_FAIL_NULL_V_MSG(m_param, m_retval, m_msg) \
|
|
@@ -259,7 +224,6 @@ extern bool _err_error_exists;
|
|
|
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Parameter ' " _STR(m_param) " ' is null.", m_msg); \
|
|
|
return m_retval; \
|
|
|
} \
|
|
|
- _err_error_exists = false; \
|
|
|
}
|
|
|
|
|
|
/** An error condition happened (m_cond tested true) (WARNING this is the opposite as assert().
|
|
@@ -272,7 +236,6 @@ extern bool _err_error_exists;
|
|
|
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Condition ' " _STR(m_cond) " ' is true."); \
|
|
|
return; \
|
|
|
} \
|
|
|
- _err_error_exists = false; \
|
|
|
}
|
|
|
|
|
|
#define ERR_FAIL_COND_MSG(m_cond, m_msg) \
|
|
@@ -281,7 +244,6 @@ extern bool _err_error_exists;
|
|
|
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Condition ' " _STR(m_cond) " ' is true.", m_msg); \
|
|
|
return; \
|
|
|
} \
|
|
|
- _err_error_exists = false; \
|
|
|
}
|
|
|
|
|
|
/** Use this one if there is no sensible fallback, that is, the error is unrecoverable.
|
|
@@ -315,7 +277,6 @@ extern bool _err_error_exists;
|
|
|
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Condition ' " _STR(m_cond) " ' is true. returned: " _STR(m_retval)); \
|
|
|
return m_retval; \
|
|
|
} \
|
|
|
- _err_error_exists = false; \
|
|
|
}
|
|
|
|
|
|
#define ERR_FAIL_COND_V_MSG(m_cond, m_retval, m_msg) \
|
|
@@ -324,7 +285,6 @@ extern bool _err_error_exists;
|
|
|
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Condition ' " _STR(m_cond) " ' is true. returned: " _STR(m_retval), m_msg); \
|
|
|
return m_retval; \
|
|
|
} \
|
|
|
- _err_error_exists = false; \
|
|
|
}
|
|
|
|
|
|
/** An error condition happened (m_cond tested true) (WARNING this is the opposite as assert().
|
|
@@ -337,7 +297,6 @@ extern bool _err_error_exists;
|
|
|
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Condition ' " _STR(m_cond) " ' is true. Continuing..:"); \
|
|
|
continue; \
|
|
|
} \
|
|
|
- _err_error_exists = false; \
|
|
|
}
|
|
|
|
|
|
#define ERR_CONTINUE_MSG(m_cond, m_msg) \
|
|
@@ -346,7 +305,6 @@ extern bool _err_error_exists;
|
|
|
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Condition ' " _STR(m_cond) " ' is true. Continuing..:", m_msg); \
|
|
|
continue; \
|
|
|
} \
|
|
|
- _err_error_exists = false; \
|
|
|
}
|
|
|
|
|
|
/** An error condition happened (m_cond tested true) (WARNING this is the opposite as assert().
|
|
@@ -359,7 +317,6 @@ extern bool _err_error_exists;
|
|
|
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Condition ' " _STR(m_cond) " ' is true. Breaking..:"); \
|
|
|
break; \
|
|
|
} \
|
|
|
- _err_error_exists = false; \
|
|
|
}
|
|
|
|
|
|
#define ERR_BREAK_MSG(m_cond, m_msg) \
|
|
@@ -368,7 +325,6 @@ extern bool _err_error_exists;
|
|
|
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Condition ' " _STR(m_cond) " ' is true. Breaking..:", m_msg); \
|
|
|
break; \
|
|
|
} \
|
|
|
- _err_error_exists = false; \
|
|
|
}
|
|
|
|
|
|
/** Print an error string and return
|
|
@@ -377,14 +333,12 @@ extern bool _err_error_exists;
|
|
|
#define ERR_FAIL() \
|
|
|
{ \
|
|
|
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Method/Function Failed."); \
|
|
|
- _err_error_exists = false; \
|
|
|
return; \
|
|
|
}
|
|
|
|
|
|
#define ERR_FAIL_MSG(m_msg) \
|
|
|
{ \
|
|
|
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Method/Function Failed.", m_msg); \
|
|
|
- _err_error_exists = false; \
|
|
|
return; \
|
|
|
}
|
|
|
|
|
@@ -394,14 +348,12 @@ extern bool _err_error_exists;
|
|
|
#define ERR_FAIL_V(m_value) \
|
|
|
{ \
|
|
|
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Method/Function Failed, returning: " __STR(m_value)); \
|
|
|
- _err_error_exists = false; \
|
|
|
return m_value; \
|
|
|
}
|
|
|
|
|
|
#define ERR_FAIL_V_MSG(m_value, m_msg) \
|
|
|
{ \
|
|
|
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Method/Function Failed, returning: " __STR(m_value), m_msg); \
|
|
|
- _err_error_exists = false; \
|
|
|
return m_value; \
|
|
|
}
|
|
|
|
|
@@ -426,13 +378,11 @@ extern bool _err_error_exists;
|
|
|
#define ERR_PRINT(m_string) \
|
|
|
{ \
|
|
|
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, m_string); \
|
|
|
- _err_error_exists = false; \
|
|
|
}
|
|
|
|
|
|
#define ERR_PRINTS(m_string) \
|
|
|
{ \
|
|
|
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, m_string); \
|
|
|
- _err_error_exists = false; \
|
|
|
}
|
|
|
|
|
|
#define ERR_PRINT_ONCE(m_string) \
|
|
@@ -440,7 +390,6 @@ extern bool _err_error_exists;
|
|
|
static bool first_print = true; \
|
|
|
if (first_print) { \
|
|
|
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, m_string); \
|
|
|
- _err_error_exists = false; \
|
|
|
first_print = false; \
|
|
|
} \
|
|
|
}
|
|
@@ -451,13 +400,11 @@ extern bool _err_error_exists;
|
|
|
#define WARN_PRINT(m_string) \
|
|
|
{ \
|
|
|
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, m_string, ERR_HANDLER_WARNING); \
|
|
|
- _err_error_exists = false; \
|
|
|
}
|
|
|
|
|
|
#define WARN_PRINTS(m_string) \
|
|
|
{ \
|
|
|
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, m_string, ERR_HANDLER_WARNING); \
|
|
|
- _err_error_exists = false; \
|
|
|
}
|
|
|
|
|
|
#define WARN_PRINT_ONCE(m_string) \
|
|
@@ -465,7 +412,6 @@ extern bool _err_error_exists;
|
|
|
static bool first_print = true; \
|
|
|
if (first_print) { \
|
|
|
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, m_string, ERR_HANDLER_WARNING); \
|
|
|
- _err_error_exists = false; \
|
|
|
first_print = false; \
|
|
|
} \
|
|
|
}
|
|
@@ -475,7 +421,6 @@ extern bool _err_error_exists;
|
|
|
static volatile bool warning_shown = false; \
|
|
|
if (!warning_shown) { \
|
|
|
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "This method has been deprecated and will be removed in the future", ERR_HANDLER_WARNING); \
|
|
|
- _err_error_exists = false; \
|
|
|
warning_shown = true; \
|
|
|
} \
|
|
|
}
|
|
@@ -485,7 +430,6 @@ extern bool _err_error_exists;
|
|
|
static volatile bool warning_shown = false; \
|
|
|
if (!warning_shown) { \
|
|
|
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "This method has been deprecated and will be removed in the future", m_msg, ERR_HANDLER_WARNING); \
|
|
|
- _err_error_exists = false; \
|
|
|
warning_shown = true; \
|
|
|
} \
|
|
|
}
|