Skip to content

Instantly share code, notes, and snippets.

@madmag77
Created March 5, 2021 11:36
Show Gist options
  • Save madmag77/af9f8017d44568013aa9afbd1f8cf1a0 to your computer and use it in GitHub Desktop.
Save madmag77/af9f8017d44568013aa9afbd1f8cf1a0 to your computer and use it in GitHub Desktop.
[Dart article] Rust exception example
use std::fs::File;
fn main() {
let f = File::open("main.jpg"); // main.jpg doesn't exist
match f {
Ok(f)=> {
println!("file found {:?}",f);
},
Err(e)=> {
println!("file not found \n{:?}",e); //handled error
}
}
println!("end of main");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment