Add engine internal error macro mjERROR to prepend calling function to error function.

PiperOrigin-RevId: 541584847
Change-Id: I57447e64375413ee07aa96372a402e1ced59ff4a
This commit is contained in:
Kyle Bayes
2023-06-19 03:28:44 -07:00
committed by Copybara-Service
parent c9e9cd8b35
commit ac1f41160d
28 changed files with 218 additions and 162 deletions
+11 -6
View File
@@ -123,16 +123,11 @@ void mju_writeLog(const char* type, const char* msg) {
}
}
// write message to logfile and console, pause and exit
void mju_error(const char* msg, ...) {
void mju_error_v(const char* msg, va_list args) {
char errmsg[1000];
// Format msg into errmsg
va_list args;
va_start(args, msg);
vsnprintf(errmsg, mjSIZEOFARRAY(errmsg), msg, args);
va_end(args);
if (_mjPRIVATE_tls_error_fn) {
_mjPRIVATE_tls_error_fn(errmsg);
@@ -150,6 +145,16 @@ void mju_error(const char* msg, ...) {
}
// write message to logfile and console, pause and exit
void mju_error(const char* msg, ...) {
va_list args;
va_start(args, msg);
mju_error_v(msg, args);
va_end(args);
}
// write message to logfile and console
void mju_warning(const char* msg, ...) {
char wrnmsg[1000];