From 7790453342f2f78bcdee28137b2b36c497ba699b Mon Sep 17 00:00:00 2001 From: Matthew Kennedy Date: Fri, 18 Dec 2020 05:48:19 -0800 Subject: [PATCH] format in tests (#2100) --- firmware/controllers/core/error_handling.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/firmware/controllers/core/error_handling.cpp b/firmware/controllers/core/error_handling.cpp index 89a43c592a..14bea08bc1 100644 --- a/firmware/controllers/core/error_handling.cpp +++ b/firmware/controllers/core/error_handling.cpp @@ -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 }