Skip to content

Commit 4b2548b

Browse files
Added error handling
1 parent 8b985e2 commit 4b2548b

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

examples/05_error_handling.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ enum AppError {
3636
impl std::fmt::Display for AppError {
3737
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3838
match self {
39-
AppError::NotFound(e) => write!(f, "Not found: {}", s),
39+
AppError::NotFound(e) => write!(f, "Not found: {}", e),
4040
AppError::ParseFailed(s) => write!(f, "Parse failed: {}", s),
4141
AppError::DivisionByZero => write!(f, "Cannot divide by zero"),
4242
}
@@ -57,7 +57,7 @@ fn main(){
5757

5858
// PART - 2: match - full control over Ok and Err
5959

60-
match divide (10.0/2){
60+
match divide (10.0, 2.0){
6161
Ok(result) => println!("10/2 = {}", result),
6262
Err(e) => println!("Error: {}", e),
6363
}

0 commit comments

Comments
 (0)