Closed mostlyobvious closed 2 years ago
I'd be wonderful to be able to dispatch errors by class rather than by checking message they pass.
Currently:
when 401 raise StreamApiResponseException, error_message(response, 'Bad feed') when 403 raise StreamApiResponseException, error_message(response, 'Bad auth/headers') when 404 raise StreamApiResponseException, error_message(response, 'url not found')
Having:
UrlNotFound = Class.new(StreamApiResponseException) when 404 raise UrlNotFound, error_message(response, 'url not found')
would be backwards compatible and enable responding differently when matching Stream::UrlNotFound === error in application codebase.
Stream::UrlNotFound === error
I appreciate this comment, had an issue trying to test for errors and having to guess the underlying implementation when it came to writing a spec @pawelpacana
fixed by #142, thanks @groyoh
I'd be wonderful to be able to dispatch errors by class rather than by checking message they pass.
Currently:
Having:
would be backwards compatible and enable responding differently when matching
Stream::UrlNotFound === error
in application codebase.