Functionality to fail gracefully in ImageResolver #169
-
The interface of IImageResolver is: public interface IImageResolver
{
Task<ImageMetadata> GetMetaDataAsync();
Task<Stream> OpenReadAsync();
} The problem is that there can be several issues with an image that can only be determined during the resolve. Currently an ImageResolver can only throw an exception in such cases. This will result in a The main problem with this is that it pollutes the error logs of the application. Here are a few issues that may occur, with the proper status code:
In .NET Framework on could throw an |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
We cannot change the interface. That's a breaking change requiring a major version, there's also no correlation between the types. We already handle 404s. ImageSharp.Web/src/ImageSharp.Web/Middleware/ImageSharpMiddleware.cs Lines 223 to 233 in c625825 We don't handle remote images other than from Azure (But you know this since you've developed an independent provider). .If you're getting 500s in your logs, you should be dealing with those errors. I'm very curious to see what they are. |
Beta Was this translation helpful? Give feedback.
We cannot change the interface. That's a breaking change requiring a major version, there's also no correlation between the types.
We already handle 404s.
ImageSharp.Web/src/ImageSharp.Web/Middleware/ImageSharpMiddleware.cs
Lines 223 to 233 in c625825