1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
// private internal
#include "private/rodeo_error.h"
// system
#include <stdlib.h>
#include <stdio.h>
void
Rodeo__\
error_exit(
Rodeo__error error,
const char *function,
int line_number,
const char *extra_info
)
{
switch(error)
{
case RODEO__ERROR__UNREACHABLE_REACHED:
printf("[ERROR] RODEO: \n\t(func: %s, line: %d)\n", function, line_number);
printf("\tUnreachable code reached.\n");
if(extra_info)
{
printf("\t%s\n", extra_info);
}
fflush(stdout);
break;
case RODEO__ERROR__UNINITIALIZED_STATE:
printf("RODEO ERROR: \n\t(func: %s, line: %d)\n", function, line_number);
printf("\tUninitialized State.\n");
if(extra_info)
{
printf("\t%s\n", extra_info);
}
fflush(stdout);
break;
default:
Rodeo__error_exit(
RODEO__ERROR__UNREACHABLE_REACHED,
__FUNCTION__,
__LINE__,
"Unhandled error code."
);
}
exit(EXIT_FAILURE);
}
|