File tree Expand file tree Collapse file tree 4 files changed +14
-10
lines changed Expand file tree Collapse file tree 4 files changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -468,14 +468,14 @@ pub struct CompileResult {
468
468
}
469
469
470
470
impl TryFrom < CompileResponse > for CompileResult {
471
- type Error = Exception ;
471
+ type Error = Box < Exception > ;
472
472
473
473
fn try_from ( response : CompileResponse ) -> Result < Self > {
474
474
let res = response. result . unwrap ( ) ;
475
475
match res {
476
476
compile_response:: Result :: Success ( success) => Ok ( success. into ( ) ) ,
477
477
compile_response:: Result :: Failure ( failure) => {
478
- Err ( Exception :: from ( failure) )
478
+ Err ( Exception :: from ( failure) . into ( ) )
479
479
}
480
480
}
481
481
}
Original file line number Diff line number Diff line change @@ -83,7 +83,9 @@ impl Embedded {
83
83
84
84
let host = Host :: new ( importer_registry, logger_registry) ;
85
85
let conn = self . channel . connect ( host) ?;
86
- let response = conn. compile_request ( request) ?;
86
+ let response = conn
87
+ . compile_request ( request)
88
+ . map_err ( |e| Box :: new ( e. into ( ) ) ) ?;
87
89
CompileResult :: try_from ( response)
88
90
}
89
91
@@ -171,7 +173,9 @@ impl Embedded {
171
173
172
174
let host = Host :: new ( importer_registry, logger_registry) ;
173
175
let conn = self . channel . connect ( host) ?;
174
- let response = conn. compile_request ( request) ?;
176
+ let response = conn
177
+ . compile_request ( request)
178
+ . map_err ( |e| Box :: new ( e. into ( ) ) ) ?;
175
179
CompileResult :: try_from ( response)
176
180
}
177
181
@@ -181,7 +185,7 @@ impl Embedded {
181
185
let importer_registry = ImporterRegistry :: default ( ) ;
182
186
let host = Host :: new ( importer_registry, logger_registry) ;
183
187
let conn = self . channel . connect ( host) ?;
184
- let response = conn. version_request ( ) ?;
188
+ let response = conn. version_request ( ) . map_err ( |e| Box :: new ( e . into ( ) ) ) ?;
185
189
Ok ( format ! (
186
190
"sass-embedded\t #{}" ,
187
191
response. implementation_version
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ use crate::{
8
8
} ;
9
9
10
10
/// An alias for [std::result::Result<T, Exception>].
11
- pub type Result < T > = std:: result:: Result < T , Exception > ;
11
+ pub type Result < T > = std:: result:: Result < T , Box < Exception > > ;
12
12
13
13
/// An exception for this crate, thrown because a Sass compilation failed or `io::Error`.
14
14
///
Original file line number Diff line number Diff line change @@ -241,7 +241,7 @@ fn wraps_an_error_in_canonicalize() {
241
241
_: & str ,
242
242
_: & ImporterOptions ,
243
243
) -> Result < Option < Url > > {
244
- Err ( Exception :: new ( "this import is bad actually" ) )
244
+ Err ( Exception :: new ( "this import is bad actually" ) . into ( ) )
245
245
}
246
246
247
247
fn load ( & self , _: & Url ) -> Result < Option < ImporterResult > > {
@@ -275,7 +275,7 @@ fn wraps_an_error_in_load() {
275
275
}
276
276
277
277
fn load ( & self , _: & Url ) -> Result < Option < ImporterResult > > {
278
- Err ( Exception :: new ( "this import is bad actually" ) )
278
+ Err ( Exception :: new ( "this import is bad actually" ) . into ( ) )
279
279
}
280
280
}
281
281
@@ -305,7 +305,7 @@ fn avoids_importer_when_canonicalize_returns_nil() {
305
305
}
306
306
307
307
fn load ( & self , _: & Url ) -> Result < Option < ImporterResult > > {
308
- Err ( Exception :: new ( "this import is bad actually" ) )
308
+ Err ( Exception :: new ( "this import is bad actually" ) . into ( ) )
309
309
}
310
310
}
311
311
@@ -1006,7 +1006,7 @@ mod file_importer {
1006
1006
_: & str ,
1007
1007
_: & ImporterOptions ,
1008
1008
) -> Result < Option < Url > > {
1009
- Err ( Exception :: new ( "this import is bad actually" ) )
1009
+ Err ( Exception :: new ( "this import is bad actually" ) . into ( ) )
1010
1010
}
1011
1011
}
1012
1012
You can’t perform that action at this time.
0 commit comments