aboutsummaryrefslogtreecommitdiffstats
path: root/src/blogc-make/error.c
blob: f02f5ea661004f20832fde9d3c520c3e894d822d (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
/*
 * blogc: A blog compiler.
 * Copyright (C) 2014-2017 Rafael G. Martins <rafael@rafaelmartins.eng.br>
 *
 * This program can be distributed under the terms of the BSD License.
 * See the file LICENSE.
 */

#include <stdio.h>
#include <squareball.h>

#include "error.h"


void
bm_error_print(sb_error_t *err)
{
    if (err == NULL)
        return;

    fprintf(stderr, "blogc-make: ");

    switch((bm_error_type_t) err->code) {
        case BLOGC_MAKE_ERROR_SETTINGS:
            fprintf(stderr, "error: settings: %s\n", err->msg);
            break;
        case BLOGC_MAKE_ERROR_EXEC:
            fprintf(stderr, "error: exec: %s\n", err->msg);
            break;
        case BLOGC_MAKE_ERROR_ATOM:
            fprintf(stderr, "error: atom: %s\n", err->msg);
            break;
        default:
            fprintf(stderr, "error: %s\n", err->msg);
    }
}