|
| 1 | +use pyo3::{pyclass, pymethods}; |
| 2 | +use pyo3::exceptions::PyException; |
| 3 | +#[pyclass(extends=PyException)] |
| 4 | +pub struct FailedBuildBot { |
| 5 | + message: String, |
| 6 | +} |
| 7 | + |
| 8 | +#[pymethods] |
| 9 | +impl FailedBuildBot { |
| 10 | + #[new] |
| 11 | + fn new(message: String) -> Self { |
| 12 | + FailedBuildBot { message } |
| 13 | + } |
| 14 | + fn __str__(&self) -> String { |
| 15 | + self.message.clone() |
| 16 | + } |
| 17 | + fn __repr__(&self) -> String { |
| 18 | + format!("FailedBuildBot(message='{}')", self.message) |
| 19 | + } |
| 20 | +} |
| 21 | + |
| 22 | +#[pyclass(extends=PyException)] |
| 23 | +struct FailedToDecodeProto { |
| 24 | + message: String, |
| 25 | +} |
| 26 | + |
| 27 | +#[pymethods] |
| 28 | +impl FailedToDecodeProto { |
| 29 | + #[new] |
| 30 | + fn new(message: String) -> Self { |
| 31 | + FailedToDecodeProto { message } |
| 32 | + } |
| 33 | + fn __str__(&self) -> String { |
| 34 | + self.message.clone() |
| 35 | + } |
| 36 | + fn __repr__(&self) -> String { |
| 37 | + format!("FailedToDecodeProto(message='{}')", self.message) |
| 38 | + } |
| 39 | +} |
| 40 | + |
| 41 | +#[pyclass(extends=PyException)] |
| 42 | +pub struct UnsupportedEventType { |
| 43 | + pub message: String, |
| 44 | +} |
| 45 | + |
| 46 | +#[pymethods] |
| 47 | +impl UnsupportedEventType { |
| 48 | + #[new] |
| 49 | + fn new(message: String) -> Self { |
| 50 | + UnsupportedEventType { message } |
| 51 | + } |
| 52 | + fn __str__(&self) -> String { |
| 53 | + self.message.clone() |
| 54 | + } |
| 55 | + fn __repr__(&self) -> String { |
| 56 | + format!("UnsupportedEventType(message='{}')", self.message) |
| 57 | + } |
| 58 | +} |
| 59 | + |
| 60 | +#[pyclass(extends=PyException)] |
| 61 | +pub struct UnsupportedBackend { |
| 62 | + message: String, |
| 63 | +} |
| 64 | + |
| 65 | +#[pymethods] |
| 66 | +impl UnsupportedBackend { |
| 67 | + #[new] |
| 68 | + fn new(message: String) -> Self { |
| 69 | + UnsupportedBackend { message } |
| 70 | + } |
| 71 | + fn __str__(&self) -> String { |
| 72 | + self.message.clone() |
| 73 | + } |
| 74 | + fn __repr__(&self) -> String { |
| 75 | + format!("UnsupportedBackend(message='{}')", self.message) |
| 76 | + } |
| 77 | +} |
0 commit comments