summaryrefslogtreecommitdiff
path: root/fitz/base_error.c
blob: c0d4a42f20abe4eddd5d4a66db597631f893cce8 (plain)
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
#include "fitz_base.h"

void fz_warn(char *fmt, ...)
{
    va_list ap;
    fprintf(stderr, "warning: ");
    va_start(ap, fmt);
    vfprintf(stderr, fmt, ap);
    va_end(ap);
    fprintf(stderr, "\n");
}

fz_error * fz_throwimp(const char *func, const char *file, int line, char *fmt, ...)
{
    va_list ap;
    fprintf(stderr, "+ %s:%d: %s(): ", file, line, func);
    va_start(ap, fmt);
    vfprintf(stderr, fmt, ap);
    va_end(ap);
    fprintf(stderr, "\n");
    return ((fz_error*)-1);
}

fz_error * fz_rethrowimp(fz_error *cause, const char *func, const char *file, int line, char *fmt, ...)
{
    va_list ap;
    fprintf(stderr, "| %s:%d: %s(): ", file, line, func);
    va_start(ap, fmt);
    vfprintf(stderr, fmt, ap);
    va_end(ap);
    fprintf(stderr, "\n");
    return cause;
}

fz_error * fz_catchimp(fz_error *cause, const char *func, const char *file, int line, char *fmt, ...)
{
    va_list ap;
    fprintf(stderr, "\\ %s:%d: %s(): ", file, line, func);
    va_start(ap, fmt);
    vfprintf(stderr, fmt, ap);
    va_end(ap);
    fprintf(stderr, "\n");
    return cause;
}