trycatch 0.1.0

Throw and catch exceptions in rust.
Documentation
#![allow(clippy::needless_return)]

use trycatch::{throw, try_catch};

fn divide(x: u32, y: u32) -> u32 {
    if y == 0 {
        throw!("y cannot be zero");
    }
    return x / y;
}

fn main() {
    try_catch! {
        try {
            divide(10, 0);
        } catch (e) {
            println!("Error: {e}");
        }
    };
}