Slack responses and errors are standardized, why don't we raise a specific exception when something fails and do it "the ruby way" instead of returning a hash on failure that needs to be parsed every single time?
Happy to contribute that. For now I just monkey patch as such:
module Slack
module Request
private
alias_method :_request, :request
def request(method, path, options)
response = _request(method, path, options)
if response.is_a?(Hash)
unless response['ok']
fail response['error']
end
end
response
end
end
end
Slack responses and errors are standardized, why don't we raise a specific exception when something fails and do it "the ruby way" instead of returning a hash on failure that needs to be parsed every single time?
Happy to contribute that. For now I just monkey patch as such: