Fastimage v1.0.0-rc4 Fastimage.Error exception View Source

Representations of various errors potentially returned by Fastimage.

Types of errors which may occur include:

  • Function execution for unsupported image types eg .tiff
  • Errors occurring during streaming
  • Errors emanating from the :hackney library, eg an attempt to access an unauthorized file.
  • Exceeding the maximum number of redirects for a url - the max number of redirects is hardcoded as 3.
  • Entering invalid input, Fastimage accepts only valid urls, a valid file path or a binary which is an image.

Exception fields

This exception has the following public fields:

  • :message - (atom) the error reason. This can be a Fastimage specific reason such as :invalid_input or something emanating from the :hackney library such as an unauthorized file error.

Error reasons

Fastimage specific reasons:

  • {:unsupported, value}: may occur when the file type is not supported by Fastimage, value can be a url or nil when handling a file or a binary.

  • :unexpected_end_of_stream_error: may occur when the end of a stream is reached unexpectedly without having determined the image type.

  • :unexpected_binary_streaming_error: may occur when an unexpected error occurred whilst streaming bytes from a binary.

  • :unexpected_file_streaming_error: may occur when an unexpected error occurred whilst streaming bytes from a file.

  • :invalid_input: may occur when an invalid type is entered as an argument to the size/1 or type/1 functions. Only a valid url, file path or binary. Any other type is considered invalid input.

:hackney specific reasons:

  • {:unexpected_http_streaming_error, url}: may occur when a streaming error occurs for the given url.

  • {:hackney_response_error, {url, status_code, reason}}: may occur when a response error is returned from :hackney. For example, access to the given url is forbidden without authorization.

  • {:max_redirects_exceeded, {url, num_redirects, max_redirects}}: may occur when the maximum number of redirects has been reached. This is currently programmatically hardcoded as 3 redirects.

unknown reasons:

reason may occur when an unknown error occurs.

Link to this section Summary

Functions

Callback implementation for Exception.message/1

Link to this section Functions

Callback implementation for Exception.message/1.