Skip to content

Commit 0f74132

Browse files
committed
Basic error-reporting module
1 parent 0976239 commit 0f74132

3 files changed

Lines changed: 11 additions & 2 deletions

File tree

rust_src/error.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pub type Error = String;
2+
3+
pub fn fail(msg: &str) -> Result<(), Error> {
4+
return Err(msg.to_string());
5+
}

rust_src/main.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1-
fn main() {
2-
println!("Hello, world!");
1+
mod error;
2+
//mod driver;
3+
4+
fn main() -> Result<(), error::Error> {
5+
return error::fail("Bad news bro!");
36
}

rustfmt.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
tab_spaces = 2

0 commit comments

Comments
 (0)