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

javascript - three.js lot of meshes optimization -

smartface.io - Proper way to change color scheme for whole application -

Email notification in google apps script -