Commit d4a29d93 authored by Tommy Olofsson's avatar Tommy Olofsson
Browse files

Print better error messages on fatal error.

parent 7ee6a039
......@@ -246,7 +246,7 @@ void labcomm_set_local_index(struct labcomm_signature *signature)
{
if (signature->index != 0) {
labcomm_error_fatal_global(LABCOMM_ERROR_SIGNATURE_ALREADY_SET,
"%s", signature->name);
"Signature already set: %s\n", signature->name);
}
signature->index = local_index;
local_index++;
......@@ -256,7 +256,7 @@ int labcomm_get_local_index(struct labcomm_signature *signature)
{
if (signature->index == 0) {
labcomm_error_fatal_global(LABCOMM_ERROR_SIGNATURE_NOT_SET,
"%s", signature->name);
"Signature not set: %s\n", signature->name);
}
return signature->index;
}
......@@ -21,12 +21,19 @@
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include "labcomm_error.h"
void labcomm_error_fatal_global(enum labcomm_error error,
char *format,
...)
{
va_list args;
fprintf(stderr, "Fatal error %d\n", error);
va_start(args, format);
vprintf(format, args);
va_end(args);
exit(1);
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment