format in tests (#2100)

This commit is contained in:
Matthew Kennedy 2020-12-18 05:48:19 -08:00 committed by GitHub
parent 7277b04039
commit 7790453342
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 4 deletions

View File

@ -280,16 +280,18 @@ void firmwareError(obd_code_e code, const char *fmt, ...) {
}
#else
printf("\x1B[31m>>>>>>>>>> firmwareError [%s]\r\n\x1B[0m", fmt);
char errorBuffer[200];
va_list ap;
va_start(ap, fmt);
vprintf(fmt, ap);
vsnprintf(errorBuffer, sizeof(errorBuffer), fmt, ap);
va_end(ap);
printf("\r\n");
printf("\x1B[31m>>>>>>>>>> firmwareError [%s]\r\n\x1B[0m\r\n", errorBuffer);
#if EFI_SIMULATOR || EFI_UNIT_TEST
throw std::logic_error(fmt);
throw std::logic_error(errorBuffer);
#endif /* EFI_SIMULATOR */
#endif
}