LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
error.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2012-2026, QORE Lab, Imperial College London
3 * All rights reserved.
4 */
5#ifndef LINE_UTIL_ERROR_H
6#define LINE_UTIL_ERROR_H
7
8/**
9 * @file
10 * @ingroup line_util
11 * The exception types the port throws.
12 *
13 * `Error` and its three refinements -- `InputError` for a malformed model or
14 * argument, `NumericError` for a computation that cannot produce an answer, and
15 * `UnsupportedError` for a feature the chosen algorithm does not cover. Nothing
16 * in the library calls `exit()` or writes to stderr on failure: the CLI catches
17 * these at `main` and the bindings map them to exceptions, so the same code path
18 * serves both.
19 */
20
21#include <stdexcept>
22#include <string>
23
24namespace line {
25
26/**
27 * Base error for the multiprecision C++ port. Nothing in the library calls
28 * exit() or prints to stderr on failure: the CLI catches these at main and the
29 * Python binding maps them to exceptions, so the same code path serves both.
30 */
31class Error : public std::runtime_error {
32public:
33 explicit Error(const std::string& what) : std::runtime_error(what) {}
34};
35
36/** Malformed or inconsistent input (dimensions, negative populations, ...). */
37class InputError : public Error {
38public:
39 explicit InputError(const std::string& what) : Error(what) {}
40};
41
42/** The algorithm cannot proceed on this instance (singular matrix, ...). */
43class NumericError : public Error {
44public:
45 explicit NumericError(const std::string& what) : Error(what) {}
46};
47
48/** Requested feature or arithmetic mode is not ported yet. */
49class UnsupportedError : public Error {
50public:
51 explicit UnsupportedError(const std::string& what) : Error(what) {}
52};
53
54} // namespace line
55
56#endif // LINE_UTIL_ERROR_H
Error(const std::string &what)
Definition error.h:33
InputError(const std::string &what)
Definition error.h:39
NumericError(const std::string &what)
Definition error.h:45
UnsupportedError(const std::string &what)
Definition error.h:51