File: errors.cpp

package info (click to toggle)
picotool 2.1.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, trixie
  • size: 4,448 kB
  • sloc: cpp: 59,935; ansic: 2,513; python: 97; sh: 48; makefile: 27; xml: 18
file content (16 lines) | stat: -rw-r--r-- 376 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <cstdarg>

#include "errors.h"

void fail(int code, std::string msg) {
    throw command_failure(code, std::move(msg));
}

void fail(int code, const char *format, ...) {
    va_list args;
    va_start(args, format);
    static char error_msg[512];
    vsnprintf(error_msg, sizeof(error_msg), format, args);
    va_end(args);
    fail(code, std::string(error_msg));
}