3 stable releases

1.1.0 Sep 7, 2022
1.0.1 Sep 7, 2022

#2084 in Rust patterns

MIT license

18KB
261 lines

Würm: non-fatal, strongly typed errors

Crates.io: wurm Documentation Build

Motivation

By default, errors in Rust are handled using Result<T, E>, which contains either a value or an error. But sometimes, you need to return a value alongside with one or many errors. In this case, you may need to use wurm.

Think of non-fatal errors as compiler warnings. The compiler will give you the result (i.e. the compiled binary) even if there are tons of warnings. You also receive the warnings and can inspect them to decide what to do.

As an alternative, you may just use a logger to yield such non-fatal errors, but you lose flexibility, because your errors will be just strings sent into a logger, and inspecting them from code can be problematic.

For motivating example and API documentation, go to the docs.

Why such name?

It's just modified word "warn" (as non-fatal errors can be also called warnings). So, "warn" → "würm" sound pretty similar.

License

This project is licensed under the MIT License. See LICENSE for more details.

No runtime deps