Debian Codegraph @

src/errors.c

raw symbols SCIP
1 /* errors.c
2 *
3 * error handling.
4 *
5 * Infernal's fatal error messages distinguish between user errors
6 * ("failure", with cm_Fail()) and internal faults ("death", with
7 * cm_Die()). For now, though, there is no difference between the two
8 * functions. Someday we might have cm_Die() print a comforting
9 * apology, or provide some help on how to report bugs to us;
10 * cm_Fail() might provide some pointers on where to read more
11 * documentation.
12 *
13 * Based on HMMER3's errors.c:
14 * SRE, Fri Jan 12 08:46:02 2007
15 */
16
17 #include <esl_config.h>
18 #include <p7_config.h>
19 #include "config.h"
20
21 #include <stdlib.h>
22 #include <stdio.h>
23
24 #include "easel.h"
25
26 #include "hmmer.h"
27
28 #include "infernal.h"
29
30 /* Function: cm_Die()
31 * Incept: EPN, Fri Jul 27 14:35:44 2007
32 *
33 * Purpose: Handle a fatal exception (something that's the system's fault,
34 * including memory allocation failures; or possibly our fault).
35 */
36 void
37 cm_Die(char *format, ...)
38 {
39 va_list argp;
40 /* format the error mesg */
41 fprintf(stderr, "\nFATAL: ");
42 va_start(argp, format);
43 vfprintf(stderr, format, argp);
44 va_end(argp);
45 fprintf(stderr, "\n");
46 fflush(stderr);
47 exit(1);
48 }
49
50 /* Function: cm_Fail()
51 * Incept: EPN, Fri Jul 27 14:35:58 2007
52 *
53 * Purpose: Handle a user error (something that's the user's fault).
54 */
55 void
56 cm_Fail(char *format, ...)
57 {
58 va_list argp;
59 /* format the error mesg */
60 fprintf(stderr, "\nError: ");
61 va_start(argp, format);
62 vfprintf(stderr, format, argp);
63 va_end(argp);
64 fprintf(stderr, "\n");
65 fflush(stderr);
66 exit(1);
67 }
68