mikel / mail

A Really Ruby Mail Library
MIT License
3.6k stars 931 forks source link

Reporting parsing errors #1362

Open sebbASF opened 4 years ago

sebbASF commented 4 years ago

A library such as this should ideally not report errors and warnings using Kernel.warn or similar.

This is because it is difficult for callers to detect when such events occur. Intercepting Warning.warn may work. However this can get complicated if the caller is a top-level app that needs to report warnings to a console.

One way round this would be to report all such events through a utility method. That could then be overridden without affecting other code.

jeremy commented 4 years ago

Agreed. We can eliminate many warnings, e.g. encoding conversion failures. Bad encodings are commonplace when parsing email and shouldn't be treated as application-level warnings. We could store them on the parsed field/header/message instead of Kernel#warning them.