someguynamedjosh / ouroboros

Easy self-referential struct generation for Rust.
Apache License 2.0
524 stars 33 forks source link

Improve formatting of the covariance error message #78

Closed nyurik closed 1 year ago

nyurik commented 1 year ago

The error message "Ouroboros cannot automatically determine if this type is covariant" generated here is not easily readable because the description is too long without a single line break. I do not know if there are any other considerations for this, so didn't want to submit a trivial PR, but i think the message should be broken up into multiple lines to simplify reading when the error is generated inside an IDE without line wrapping. I don't think any of the built-in error messages rely on term width to wrap. Thanks for an awesome crate! (but I still hope it will become part of the core :) )

someguynamedjosh commented 1 year ago

This is an excellent point, the current error is a lengthy description that should really start with a brief tag phrase.

Does "Unknown Covariance" followed by the original error sound good or is that too vague?

nyurik commented 1 year ago

@joshua-maros the error already has a pretty good first line summary Ouroboros cannot automatically determine if this type is covariant. -- I think it is the later text that should be broken into lines

someguynamedjosh commented 1 year ago

Ah, I see what you are saying now. I'll make that change.

nyurik commented 1 year ago

Thanks! Also, you may want to reread that error message too, it took me a few reads to understand it. But then again, not sure how to make it more comprehensible. Thanks!!!