Dominic Grimm
7490439223
All checks were successful
continuous-integration/drone/push Build is passing
31 lines
647 B
C
31 lines
647 B
C
#include "ansi_lib.h"
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
#include "hydroforth/hydroforth.h"
|
|
|
|
void hf__handle_error_light(struct hf__error_wrapper *error) {
|
|
SET_8_VALUE_COLOUR(TXT_RED);
|
|
printf("Error: %s", HF__ERROR_STR[error->error]);
|
|
|
|
if (error->msg) {
|
|
printf(": ");
|
|
SET_8_VALUE_COLOUR(TXT_GREEN);
|
|
printf("%s", error->msg);
|
|
SET_8_VALUE_COLOUR(TXT_RED);
|
|
if (error->msg_is_freeable) {
|
|
free(error->msg);
|
|
}
|
|
}
|
|
putchar(' ');
|
|
|
|
SET_8_VALUE_COLOUR(TXT_YELLOW);
|
|
printf("[0x%x]", error->error);
|
|
|
|
SET_8_VALUE_COLOUR(TXT_DEFAULT);
|
|
|
|
if (HF__ERROR_PANIC[error->error]) {
|
|
putchar('\n');
|
|
exit(1);
|
|
}
|
|
} |