我通过他们的REST API连接到Docusign。目前,我正在拯救所有我不明白的例外情况。我想挽救API抛出的某些异常。当我从API收到异常时,它会在控制台中显示以下内容:
{"errorCode"=>"USER_AUTHENTICATION_FAILED", "message"=>"One or both of Username and Password are invalid."}
他们的错误格式是:
(errorDetails.errorCode) and associated messages (errorDetails.message)
我如何通过他们发回给我的回复来拯救个别例外?我目前的代码是:
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
答案 0 :(得分:0)
您可以提供多个您想要拯救的异常类:
struct UIViewAnimationOptions : RawOptionSetType {
init(_ rawValue: UInt)
init(rawValue rawValue: UInt)
static var LayoutSubviews: UIViewAnimationOptions { get }
static var AllowUserInteraction: UIViewAnimationOptions { get }
static var BeginFromCurrentState: UIViewAnimationOptions { get }
static var Repeat: UIViewAnimationOptions { get }
static var Autoreverse: UIViewAnimationOptions { get }
static var OverrideInheritedDuration: UIViewAnimationOptions { get }
}