Skip to content

pyrocord/pyexc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pyexc

An easy way to define Python exceptions.

use pyexc::PythonException;

#[derive(PythonException)]
pub enum MyBaseException {
    #[base(module = "errors")]
    #[format("Hello")]
    Base,
    #[format("World")]
    Bar,
    #[format("!")]
    Baz,
}

// Inheritance is experimental!

#[derive(PythonException)]
pub enum MySubException {
    #[base(module = "other_errors", inherits = "errors.MyBaseException")]
    #[format("Error!")]
    BaseBase,
    #[format("SEGFAULT")]
    FooBar,
    #[format("Fatal!")]
    FooBaz,
}

Allows usage in Result, as well as providing a generally Rust-like interface for Python exceptions.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages