@@ -97,8 +97,10 @@ impl i_slint_core::model::Model for PyModelShared {
97
97
let result = match obj. call_method0 ( py, "row_count" ) {
98
98
Ok ( result) => result,
99
99
Err ( err) => {
100
- eprintln ! (
101
- "Python: Model implementation of row_count() threw an exception: {err}"
100
+ crate :: handle_unraisable (
101
+ py,
102
+ "Python: Model implementation of row_count() threw an exception" . into ( ) ,
103
+ err,
102
104
) ;
103
105
return 0 ;
104
106
}
@@ -107,7 +109,11 @@ impl i_slint_core::model::Model for PyModelShared {
107
109
match result. extract :: < usize > ( py) {
108
110
Ok ( count) => count,
109
111
Err ( err) => {
110
- eprintln ! ( "Python: Model implementation of row_count() returned value that cannot be cast to usize: {err}" ) ;
112
+ crate :: handle_unraisable (
113
+ py,
114
+ "Python: Model implementation of row_count() returned value that cannot be cast to usize" . into ( ) ,
115
+ err,
116
+ ) ;
111
117
0
112
118
}
113
119
}
@@ -126,8 +132,10 @@ impl i_slint_core::model::Model for PyModelShared {
126
132
Ok ( result) => result,
127
133
Err ( err) if err. is_instance_of :: < PyIndexError > ( py) => return None ,
128
134
Err ( err) => {
129
- eprintln ! (
130
- "Python: Model implementation of row_data() threw an exception: {err}"
135
+ crate :: handle_unraisable (
136
+ py,
137
+ "Python: Model implementation of row_data() threw an exception" . into ( ) ,
138
+ err,
131
139
) ;
132
140
return None ;
133
141
}
@@ -140,7 +148,11 @@ impl i_slint_core::model::Model for PyModelShared {
140
148
) {
141
149
Ok ( pv) => Some ( pv) ,
142
150
Err ( err) => {
143
- eprintln ! ( "Python: Model implementation of row_data() returned value that cannot be converted to Rust: {err}" ) ;
151
+ crate :: handle_unraisable (
152
+ py,
153
+ "Python: Model implementation of row_data() returned value that cannot be cast to usize" . into ( ) ,
154
+ err,
155
+ ) ;
144
156
None
145
157
}
146
158
}
@@ -165,8 +177,10 @@ impl i_slint_core::model::Model for PyModelShared {
165
177
if let Err ( err) =
166
178
obj. call_method1 ( py, "set_row_data" , ( row, type_collection. to_py_value ( data) ) )
167
179
{
168
- eprintln ! (
169
- "Python: Model implementation of set_row_data() threw an exception: {err}"
180
+ crate :: handle_unraisable (
181
+ py,
182
+ "Python: Model implementation of set_row_data() threw an exception" . into ( ) ,
183
+ err,
170
184
) ;
171
185
} ;
172
186
} ) ;
0 commit comments