Skip to content

How do I produce meaningful error messages? #234

@flisk

Description

@flisk

First off, thank you very much for your work on this crate. I've had a lot of fun maintaining my IRC bot written against this library for over a year now.

I'm a little confused about how I can produce meaningful user-facing error messages with 0.15.0. Unfortunately the examples don't seem to shed any light on this.

My application performs reconnect attempts in a loop and reports errors by log, so I'd like to catch any type of error in that loop, report it to the user, and proceed to reconnect. I'm able to obtain an irc::error::Error from the failure::Errors falling out of client.identify(), stream.next() and so on, but simply .to_string()'ing or printing these errors produces very vague results. For example:

an io error occurred

Debug-formatting produces more useful but less user-friendly output:

Io(Custom { kind: Uncategorized, error: "failed to lookup address information: Name or service not known" })

I've taken a look at error.rs. Is my application supposed to match and implement specific behavior for every error type, or is the vagueness of these error messages unintended?

I'd appreciate any pointers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions