libCATS
Loading...
Searching...
No Matches
error.h
Go to the documentation of this file.
1
6#ifndef CATS_ERROR_H
7#define CATS_ERROR_H
8
9#define CATS_FAIL 0
10#define CATS_SUCCESS 1
11
12// Maybe find a better way to do this? Feels wrong.
13//#define throw(err) do { cats_throw_err(err, #err " " (__FILE__ + SOURCE_PATH_SIZE) __LINE__); return CATS_FAIL; } while(0)
14#define throw(err) do { cats_throw_err(err, #err); return CATS_FAIL; } while(0)
15#define throw_msg(err, msg) do { cats_throw_err(err, #err " " msg); return CATS_FAIL; } while(0)
16
22typedef enum {
23 MALLOC_FAIL,
24 UNSUPPORTED_WHISKER,
25 DECODE_FAIL,
26 PACKET_TOO_BIG,
27 INVALID_OR_NO_CALLSIGN,
28 INVALID_OR_NO_COMMENT,
29 LDPC_DECODE_FAIL,
30 INVALID_CRC,
31 WHISKER_NOT_FOUND,
32 EMPTY_PACKET,
33 MAX_WHISKERS_OF_TYPE_EXCEEDED
35
40
44extern char cats_error_str[255];
45
49void cats_throw_err(cats_error_t error, const char* msg);
50
51#endif // CATS_ERROR_H
cats_error_t
Error codes for libCATS.
Definition error.h:22
cats_error_t cats_error
The most recent error thrown by libCATS.
Definition error.c:6
char cats_error_str[255]
Error string for the most recent error thrown by libCATS.
Definition error.c:7
void cats_throw_err(cats_error_t error, const char *msg)
Do NOT use this function directly, use throw() instead.
Definition error.c:9