forked from mohamadkav/HMMsim-Server
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathError.cpp
More file actions
executable file
·35 lines (28 loc) · 719 Bytes
/
Error.cpp
File metadata and controls
executable file
·35 lines (28 loc) · 719 Bytes
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
/*
* Copyright (c) 2015 Santiago Bock
*
* See the file LICENSE.txt for copying permission.
*/
#include "Error.H"
#include <cstdio>
#include <cstdlib>
#include <cerrno>
#include <sys/cdefs.h>
char msg_buffer[MAX_MSG_SIZE];
uint64 debug2_timestamp = std::numeric_limits<uint64>::max();
void print_error(char *msg){
print_warn(msg);
exit(EXIT_FAILURE);
}
void print_warn(char *msg){
if (errno == 0){
fputs(msg, stderr);
fputs("\n", stderr);
} else {
perror(msg);
}
}
void print_assert(uint64 timestamp, const char *assertion, const char *file, unsigned line, const char *function){
fprintf(stderr, "%lu: %s:%u: %s: Assertion '%s' failed.\n", timestamp, file, line, function, assertion);
abort();
}