slack-ruby-client icon indicating copy to clipboard operation
slack-ruby-client copied to clipboard

Error details aren't passed through

Open kevinrobayna opened this issue 2 years ago • 5 comments

I see we have cassettes here https://github.com/slack-ruby/slack-ruby-client/blob/bf5bb4be3e03e9bd74d22942a61d5611f5c1d997/spec/fixtures/slack/web/views_open_error.yml#L79

but the error we get, if something fails, is just invalid_arguments, is this on purpose?

kevinrobayna avatar Jun 22 '23 15:06 kevinrobayna

Do you mean it doesn't include response_metadata? We should, it's not on purpose.

dblock avatar Jun 22 '23 18:06 dblock

Actually, the response metadata is present 😅

I was expecting when printing e that I'd get all the details from the error (instead I was only getting the error message)


        client.views_open(
          view: view,
          trigger_id: request[:trigger_id]
        )
      rescue Slack::Web::Api::Errors::InvalidArguments => e
        puts e # prints invalid_arguments
        puts e.error # prints invalid_arguments
        puts e.response_metadata # prints the error from slack's api
      end

kevinrobayna avatar Jun 22 '23 20:06 kevinrobayna

Closing since people can get the error details as expected I was just being silly 😅

kevinrobayna avatar Jun 22 '23 20:06 kevinrobayna

We could change to_s to display it.

dblock avatar Jun 23 '23 00:06 dblock

yeah! raised a PR for it, let me know your thoughts

https://github.com/slack-ruby/slack-ruby-client/pull/483

kevinrobayna avatar Jun 23 '23 08:06 kevinrobayna