Skip to content

Document exceptions correctly #1110

@antonfirsov

Description

@antonfirsov
  • Image.Load overloads are marked as throwing UnknownImageFormatException however when the image content is incorrect, we throw ImageFormatException instead. We should consider defining, utilizing and documenting a new InvalidImageContentException for these cases. Alternatively we can just make the xmldocs to refer to ImageFormatException, as an easier solution, but having a separate ImageFormatException subclass seems more correct to me.
  • In Image.FromFile.cs and Image.FromBytes.cs we do not document the above exceptions at all.
  • ImageProcessingException is not documented on the API surface. I would suggest to add it to: Mutate, Clone and IImageProcessor<TPixel>.Execute, however I haven't analyzed the call hierarchy whether it is the correct thing to do.
  • Review our API if there are any other missing exception docs.

If we decide to indroduce InvalidImageContentException, that part should be probably done for RC1, since it is a breaking change.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions