Skip to content

Commit 77faa52

Browse files
committed
log open strategy
1 parent 17cfb5d commit 77faa52

6 files changed

Lines changed: 209 additions & 37 deletions

File tree

src/odr/exceptions.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include <odr/exceptions.hpp>
22

33
#include <odr/file.hpp>
4+
#include <odr/odr.hpp>
45

56
namespace odr {
67

@@ -18,11 +19,19 @@ FileNotFound::FileNotFound(const std::string &path)
1819
UnknownFileType::UnknownFileType() : std::runtime_error("unknown file type") {}
1920

2021
UnsupportedFileType::UnsupportedFileType(const FileType file_type)
21-
: std::runtime_error("unknown file type"), file_type{file_type} {}
22+
: std::runtime_error("unknown file type: " +
23+
file_type_to_string(file_type)),
24+
file_type{file_type} {}
2225

2326
UnknownDecoderEngine::UnknownDecoderEngine()
2427
: std::runtime_error("unknown decoder engine") {}
2528

29+
UnsupportedDecoderEngine::UnsupportedDecoderEngine(
30+
const DecoderEngine decoder_engine)
31+
: std::runtime_error("unsupported decoder engine: " +
32+
decoder_engine_to_string(decoder_engine)),
33+
decoder_engine{decoder_engine} {}
34+
2635
FileReadError::FileReadError() : std::runtime_error("file read error") {}
2736

2837
FileWriteError::FileWriteError(const std::string &path)

src/odr/exceptions.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace odr {
66
enum class FileType;
7+
enum class DecoderEngine;
78

89
/// @brief Unsupported operation exception
910
struct UnsupportedOperation final : public std::runtime_error {
@@ -34,6 +35,13 @@ struct UnknownDecoderEngine final : public std::runtime_error {
3435
UnknownDecoderEngine();
3536
};
3637

38+
/// @brief Unsupported decoder engine exception
39+
struct UnsupportedDecoderEngine final : public std::runtime_error {
40+
DecoderEngine decoder_engine;
41+
42+
explicit UnsupportedDecoderEngine(DecoderEngine decoder_engine);
43+
};
44+
3745
/// @brief File read error
3846
struct FileReadError final : public std::runtime_error {
3947
FileReadError();

0 commit comments

Comments
 (0)