Rescuing third party REST API exception in Rails -


i connecting docusign via rest api. currently, i'm rescuing exceptions understand not idea. rescue exceptions thrown api. when receive exception api right displays following in console:

{"errorcode"=>"user_authentication_failed", "message"=>"one or both of username , password invalid."} 

the formatting of errors is:

(errordetails.errorcode) , associated messages (errordetails.message) 

how can rescue individual exceptions response they're sending me? current code is:

def show    begin     client = docusignrest::client.new     [other api actions]   rescue [rescue user_authentication_failed here]     [log exception here]   rescue => e     [log exception here]   end  end 

you can provide multiple exception classes rescue:

begin    client = docusignrest::client.new   # stuff rescue docusigncrazyerror, docusignbreakingerror, docusignanothererror => error   # log exception end 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

javascript - How to insert selected radio button value into table cell -

css - Transitioning Transforms in Safari look terrible/shaky/stuttering -