blob: 4549a0fb88cf2d126bb99f796afaed1e48971311 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
//! ref: composer/src/Composer/Json/JsonValidationException.php
use shirabe_php_shim::Exception;
#[derive(Debug)]
pub struct JsonValidationException {
inner: Exception,
pub(crate) errors: Vec<String>,
}
impl JsonValidationException {
pub fn new(message: String, errors: Vec<String>) -> Self {
Self {
inner: Exception { message, code: 0 },
errors,
}
}
pub fn get_errors(&self) -> &Vec<String> {
&self.errors
}
pub fn get_message(&self) -> &str {
&self.inner.message
}
}
impl std::fmt::Display for JsonValidationException {
fn fmt(&self, _f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
todo!()
}
}
impl std::error::Error for JsonValidationException {}
|