60 lines
1.3 KiB
C++
60 lines
1.3 KiB
C++
|
|
|
||
|
|
|
||
|
|
|
||
|
|
#ifndef LOGGING_LOGGINGEXCEPT_H_
|
||
|
|
#define LOGGING_LOGGINGEXCEPT_H_
|
||
|
|
|
||
|
|
#include <exception>
|
||
|
|
#include <stdint.h>
|
||
|
|
#include <cstddef>
|
||
|
|
|
||
|
|
namespace logging {
|
||
|
|
|
||
|
|
struct exceeded_maximum_length : std::exception {
|
||
|
|
|
||
|
|
uint16_t exceeded_length;
|
||
|
|
|
||
|
|
exceeded_maximum_length(uint16_t _exceeded_length) : exceeded_length(_exceeded_length) {}
|
||
|
|
const char * what() const noexcept { return "Logging: attempts to exceed maximum allowed size"; }
|
||
|
|
|
||
|
|
};
|
||
|
|
|
||
|
|
struct out_of_range : std::exception {
|
||
|
|
|
||
|
|
uint16_t range;
|
||
|
|
|
||
|
|
out_of_range(uint16_t _range) : range(_range) {}
|
||
|
|
const char * what() const noexcept { return "Logging: arguments outside of expected range"; }
|
||
|
|
|
||
|
|
};
|
||
|
|
|
||
|
|
struct max_allowed_size : std::exception {
|
||
|
|
|
||
|
|
uint16_t size;
|
||
|
|
|
||
|
|
max_allowed_size(size_t _size) : size(_size) { }
|
||
|
|
const char * what() const noexcept { return "Logging: attempts to exceed maximum allowed size"; }
|
||
|
|
|
||
|
|
};
|
||
|
|
|
||
|
|
struct logic_error : std::exception {
|
||
|
|
|
||
|
|
logic_error() {}
|
||
|
|
const char * what() const noexcept { return "Logging: violations of logical preconditions"; }
|
||
|
|
|
||
|
|
};
|
||
|
|
|
||
|
|
|
||
|
|
struct exceptional_record : std::exception {
|
||
|
|
|
||
|
|
uint16_t level;
|
||
|
|
|
||
|
|
exceptional_record(uint16_t _level) : level(_level) {}
|
||
|
|
const char * what() const noexcept { return "Logging: attempts to publish exceptional record"; }
|
||
|
|
|
||
|
|
};
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
#endif //LOGGING_LOGGINGEXCEPT_H_
|