mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-06-18 20:16:51 +02:00
start work on webconsole with templates
Signed-off-by: R4SAS <r4sas@i2pmail.org>
This commit is contained in:
parent
47460d86b2
commit
a843be75f3
60 changed files with 24925 additions and 38 deletions
47
libi2pd_webconsole/inja/exceptions.hpp
Normal file
47
libi2pd_webconsole/inja/exceptions.hpp
Normal file
|
@ -0,0 +1,47 @@
|
|||
#ifndef INCLUDE_INJA_EXCEPTIONS_HPP_
|
||||
#define INCLUDE_INJA_EXCEPTIONS_HPP_
|
||||
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
|
||||
namespace inja {
|
||||
|
||||
struct SourceLocation {
|
||||
size_t line;
|
||||
size_t column;
|
||||
};
|
||||
|
||||
struct InjaError : public std::runtime_error {
|
||||
const std::string type;
|
||||
const std::string message;
|
||||
|
||||
const SourceLocation location;
|
||||
|
||||
explicit InjaError(const std::string& type, const std::string& message)
|
||||
: std::runtime_error("[inja.exception." + type + "] " + message), type(type), message(message), location({0, 0}) {}
|
||||
|
||||
explicit InjaError(const std::string& type, const std::string& message, SourceLocation location)
|
||||
: std::runtime_error("[inja.exception." + type + "] (at " + std::to_string(location.line) + ":" + std::to_string(location.column) + ") " + message),
|
||||
type(type), message(message), location(location) {}
|
||||
};
|
||||
|
||||
struct ParserError : public InjaError {
|
||||
explicit ParserError(const std::string& message, SourceLocation location): InjaError("parser_error", message, location) {}
|
||||
};
|
||||
|
||||
struct RenderError : public InjaError {
|
||||
explicit RenderError(const std::string& message, SourceLocation location): InjaError("render_error", message, location) {}
|
||||
};
|
||||
|
||||
struct FileError : public InjaError {
|
||||
explicit FileError(const std::string& message): InjaError("file_error", message) {}
|
||||
explicit FileError(const std::string& message, SourceLocation location): InjaError("file_error", message, location) {}
|
||||
};
|
||||
|
||||
struct DataError : public InjaError {
|
||||
explicit DataError(const std::string& message, SourceLocation location): InjaError("data_error", message, location) {}
|
||||
};
|
||||
|
||||
} // namespace inja
|
||||
|
||||
#endif // INCLUDE_INJA_EXCEPTIONS_HPP_
|
Loading…
Add table
Add a link
Reference in a new issue