We don't currently pass the Faraday environment when raising a NotFound
exception in the Status middleware. This is inconsistent with other types of
errors that inherit from ApiError and causes us to lose any JSON API errors
that might be present in the environment.
This change reworks the NotFound exception constructor such that it accepts
a Faraday::Env and an optional message. If an environment is passed and a
msg is not, it sets a message using environment[:url] to maintain previous
messaging. However, it passes along the environment to the super call such
that we can supplement the messaging with the JSON API error message
handling implemented on ApiError.
If the first argument provided to the constructor is anything other than a
Faraday::Env, then the previous behavior is provided.
We don't currently pass the Faraday environment when raising a
NotFound
exception in theStatus
middleware. This is inconsistent with other types of errors that inherit fromApiError
and causes us to lose any JSON API errors that might be present in the environment.This change reworks the
NotFound
exception constructor such that it accepts a Faraday::Env and an optional message. If an environment is passed and amsg
is not, it sets a message usingenvironment[:url]
to maintain previous messaging. However, it passes along the environment to thesuper
call such that we can supplement the messaging with the JSON API error message handling implemented onApiError
.If the first argument provided to the constructor is anything other than a
Faraday::Env
, then the previous behavior is provided.