-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove hard-coded logging #11
Comments
I'll just wait untill The downside is that it will then require any users to upgrade to Then it'll be easy to ignore missing image errors with something like if err != nil && !errors.Is(err, pdf.ErrMissingImage) {
// ....
} EDIT: That may not work, because that will suppress every error if any error is the |
That's what unwrapping of errors is for. That is of no concern. I think that missing images should not even cause errors to begin with. As the alt issue i linked, the document should render alt text or some placeholder. |
I agree it shouldn't prevent rendering and should use the alt text instead. Still, a user should have a way to know if such a thing happens during rendering, for example, a browser will show a console error and an error in the network tab. Maybe a middle ground will be an option to indicate whether not-found images should be treated as errors or not |
True, but you are rendering essentially an html page where missing images are perfectly fine and the sole reason alt even exists. If this would be a dedicated pdf builder/renderer, sure, but it is not. It's literally markdown renderer. |
If there is error during rendering, like missing image, I will get a log:
This is not good because I have no control over this. I don't even think this should be a log. It should be simply returned error which can be ignored, or not. Adding something like WithLog(someInterace) may sound like good idea at first but in reality it is useless. Hence I think there should dedicated error that can join multiple errors(multiple missing images) which can be then processed by the caller or ignored, depending on severity(ie var ErrMissingImage = errors.New(...) with errors.Is()). The final document can still be used even with missing images hence why it should not be a hard error. Also, this specifically ties to #7
The text was updated successfully, but these errors were encountered: