File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -201,14 +201,21 @@ path = "{}.rs""#,
201
201
}
202
202
203
203
pub fn state ( & self ) -> State {
204
- let mut source_file =
205
- File :: open ( & self . path ) . expect ( "We were unable to open the exercise file!" ) ;
204
+ let mut source_file = File :: open ( & self . path ) . unwrap_or_else ( |e| {
205
+ panic ! (
206
+ "We were unable to open the exercise file {}! {e}" ,
207
+ self . path. display( )
208
+ )
209
+ } ) ;
206
210
207
211
let source = {
208
212
let mut s = String :: new ( ) ;
209
- source_file
210
- . read_to_string ( & mut s)
211
- . expect ( "We were unable to read the exercise file!" ) ;
213
+ source_file. read_to_string ( & mut s) . unwrap_or_else ( |e| {
214
+ panic ! (
215
+ "We were unable to read the exercise file {}! {e}" ,
216
+ self . path. display( )
217
+ )
218
+ } ) ;
212
219
s
213
220
} ;
214
221
You can’t perform that action at this time.
0 commit comments