forked from slint-ui/slint
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patherrors.rs
116 lines (91 loc) · 3.23 KB
/
errors.rs
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
// Copyright © SixtyFPS GmbH <[email protected]>
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
use pyo3::PyErr;
pub struct PyGetPropertyError(pub slint_interpreter::GetPropertyError);
impl From<PyGetPropertyError> for PyErr {
fn from(err: PyGetPropertyError) -> Self {
pyo3::exceptions::PyValueError::new_err(err.0.to_string())
}
}
impl From<slint_interpreter::GetPropertyError> for PyGetPropertyError {
fn from(err: slint_interpreter::GetPropertyError) -> Self {
Self(err)
}
}
pub struct PySetPropertyError(pub slint_interpreter::SetPropertyError);
impl From<PySetPropertyError> for PyErr {
fn from(err: PySetPropertyError) -> Self {
pyo3::exceptions::PyValueError::new_err(err.0.to_string())
}
}
impl From<slint_interpreter::SetPropertyError> for PySetPropertyError {
fn from(err: slint_interpreter::SetPropertyError) -> Self {
Self(err)
}
}
pub struct PyPlatformError(pub slint_interpreter::PlatformError);
impl From<PyPlatformError> for PyErr {
fn from(err: PyPlatformError) -> Self {
pyo3::exceptions::PyRuntimeError::new_err(err.0.to_string())
}
}
impl From<slint_interpreter::PlatformError> for PyPlatformError {
fn from(err: slint_interpreter::PlatformError) -> Self {
Self(err)
}
}
pub struct PyEventLoopError(pub slint_interpreter::EventLoopError);
impl From<PyEventLoopError> for PyErr {
fn from(err: PyEventLoopError) -> Self {
pyo3::exceptions::PyRuntimeError::new_err(err.0.to_string())
}
}
impl From<slint_interpreter::EventLoopError> for PyEventLoopError {
fn from(err: slint_interpreter::EventLoopError) -> Self {
Self(err)
}
}
pub struct PyInvokeError(pub slint_interpreter::InvokeError);
impl From<PyInvokeError> for PyErr {
fn from(err: PyInvokeError) -> Self {
pyo3::exceptions::PyRuntimeError::new_err(err.0.to_string())
}
}
impl From<slint_interpreter::InvokeError> for PyInvokeError {
fn from(err: slint_interpreter::InvokeError) -> Self {
Self(err)
}
}
pub struct PySetCallbackError(pub slint_interpreter::SetCallbackError);
impl From<PySetCallbackError> for PyErr {
fn from(err: PySetCallbackError) -> Self {
pyo3::exceptions::PyRuntimeError::new_err(err.0.to_string())
}
}
impl From<slint_interpreter::SetCallbackError> for PySetCallbackError {
fn from(err: slint_interpreter::SetCallbackError) -> Self {
Self(err)
}
}
pub struct PyLoadImageError(pub slint_interpreter::LoadImageError);
impl From<PyLoadImageError> for PyErr {
fn from(err: PyLoadImageError) -> Self {
pyo3::exceptions::PyRuntimeError::new_err(err.0.to_string())
}
}
impl From<slint_interpreter::LoadImageError> for PyLoadImageError {
fn from(err: slint_interpreter::LoadImageError) -> Self {
Self(err)
}
}
pub struct PyColorParseError(pub css_color_parser2::ColorParseError);
impl From<PyColorParseError> for PyErr {
fn from(err: PyColorParseError) -> Self {
pyo3::exceptions::PyRuntimeError::new_err(err.0.to_string())
}
}
impl From<css_color_parser2::ColorParseError> for PyColorParseError {
fn from(err: css_color_parser2::ColorParseError) -> Self {
Self(err)
}
}