userver: userver/compression/error.hpp Source File
Loading...
Searching...
No Matches
error.hpp
1#pragma once
2
3#include <stdexcept>
4
5#include <fmt/format.h>
6
7USERVER_NAMESPACE_BEGIN
8
9namespace compression {
10
11/// Base class for decompression errors
12class DecompressionError : public std::runtime_error {
13 using std::runtime_error::runtime_error;
14};
15
16/// Decompressed data size exceeds the limit
17class TooBigError : public DecompressionError {
18public:
19 TooBigError() : DecompressionError("Decompressed data exceeds the limit") {}
20};
21
22class ErrWithCode : public DecompressionError {
23public:
24 explicit ErrWithCode(const char* errName) : DecompressionError(fmt::format("Decompression failed: {}", errName)) {}
25};
26
27} // namespace compression
28
29USERVER_NAMESPACE_END