• treadful@lemmy.zip
    link
    fedilink
    English
    arrow-up
    2
    ·
    17 hours ago

    I see you’re using strings. You can do that, but then you’ll lose control over formatting, and additional context info that might be contained in them.

    I just haven’t figured out how to jam multiple error types into one enum variant yet. There’s no reason for the consumer of the module to get more pointless variants, so I’m not really sure I want an enum of enums, but maybe I’m overthinking it. I’ll fiddle more and check out your link later today.

    • jenesaisquoi@feddit.org
      link
      fedilink
      English
      arrow-up
      1
      ·
      4 hours ago

      You can do type erasure by converting your errors to Box<dyn Error>, then they have the same type and can be in the same enum variant