Skip to content

Ruby exceptions hide error messages #533

Open
@bpo

Description

@bpo

Version info

  • intercom-ruby version: intercom-4.0.1
  • Ruby version: 2.6.6

Expected behavior

Exception objects raised by the Intercom client should include the error message, as are surfaced by the API. For example, this is a possible API response body associated with a 403 Forbidden response code. The message is very important to understanding why the action is forbidden:

{"type":"error.list","request_id":"xxx","errors":[{"code":"action_forbidden","message":"This user is unsubscribed from emails"}]}"

Actual behavior

The Ruby client masks all details of the error returned by the API, and surfaces only a blank Ruby object that can be used to guess the return code, but not the message:

#Intercom::AuthenticationError:Forbidden @http_code=nil @application_error_code=nil @field=nil @request_id=nil

Steps to reproduce

  1. Trigger any 40x or 50x response from the API

Additional details

It looks like the client was designed to parse these error messages properly in raise_application_errors_on_failure, but most non-20x response codes will abort client handling early in raise_errors_on_failure

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions