Explorar o código

[Convert] Report file name when raising an error

Slava Barinov %!s(int64=2) %!d(string=hai) anos
pai
achega
9eb610026d
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      src/convert.rs

+ 1 - 1
src/convert.rs

@@ -9,7 +9,7 @@ use std::fs;
 
 /// Read json file with receipt and convert it into `receipt::Purchase`
 pub fn read_file(f: &str) -> receipt::Purchase {
-    let json = fs::read_to_string(f).expect("Can't read file");
+    let json = fs::read_to_string(f).expect(format!("Can't read file {}", f).as_str());
     receipt::parse_purchase(&json)
 }