Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing api error #6

Merged
merged 1 commit into from
Feb 22, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion OmiseGO.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'OmiseGO'
s.version = '0.9.2'
s.version = '0.9.3'
s.license = 'Apache'
s.summary = 'The OmiseGO iOS SDK allows developers to easily interact with a node of the OmiseGO eWallet.'
s.homepage = 'https://omisego.network/'
Expand Down
6 changes: 6 additions & 0 deletions Source/API/APIError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ public struct APIError {
case unknownServerError
case accessTokenNotFound
case accessTokenExpired
case missingIdempotencyToken
case other(String)

//swiftlint:disable:next cyclomatic_complexity
init(code: String) {
switch code {
case "client:invalid_parameter":
Expand All @@ -59,6 +61,8 @@ public struct APIError {
self = .accessTokenNotFound
case "user:access_token_expired":
self = .accessTokenExpired
case "client:no_idempotency_token_provided":
self = .missingIdempotencyToken
case let code:
self = .other(code)
}
Expand Down Expand Up @@ -88,6 +92,8 @@ public struct APIError {
return "user:access_token_not_found"
case .accessTokenExpired:
return "user:access_token_expired"
case .missingIdempotencyToken:
return "client:no_idempotency_token_provided"
case .other(let code):
return code
}
Expand Down