diff options
Diffstat (limited to 'crates/shirabe-external-packages/src/seld/json_lint/parsing_exception.rs')
| -rw-r--r-- | crates/shirabe-external-packages/src/seld/json_lint/parsing_exception.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/crates/shirabe-external-packages/src/seld/json_lint/parsing_exception.rs b/crates/shirabe-external-packages/src/seld/json_lint/parsing_exception.rs index 3ec6b6b..b756c1b 100644 --- a/crates/shirabe-external-packages/src/seld/json_lint/parsing_exception.rs +++ b/crates/shirabe-external-packages/src/seld/json_lint/parsing_exception.rs @@ -4,6 +4,21 @@ pub struct ParsingException { pub code: i64, } +impl ParsingException { + pub fn new(message: String, _details: Option<shirabe_php_shim::PhpMixed>) -> Self { + Self { message, code: 0 } + } + + pub fn get_message(&self) -> &str { + &self.message + } + + pub fn get_details(&self) -> indexmap::IndexMap<String, shirabe_php_shim::PhpMixed> { + // TODO(phase-b): PHP ParsingException exposes ['text', 'line', 'token'] details + indexmap::IndexMap::new() + } +} + impl std::fmt::Display for ParsingException { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "{}", self.message) |
