Skip to content

Commit

Permalink
feat: migrate error from SolanaError to SolanaSwift.APIClientError
Browse files Browse the repository at this point in the history
  • Loading branch information
bigearsenal committed May 15, 2023
1 parent b90a6ca commit c15012e
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Sources/OrcaSwapSwift/OrcaSwap/OrcaSwap.swift
Original file line number Diff line number Diff line change
Expand Up @@ -423,14 +423,22 @@ public class OrcaSwap: OrcaSwapType {
where: { error in
if let error = error as? SolanaError {
switch error {
case .invalidResponse(let error) where error.data?.logs?.contains("Program log: Error: InvalidAccountData") == true:
return true
case .transactionError(_, logs: let logs) where logs.contains("Program log: Error: InvalidAccountData"):
return true
default:
break
}
}

if let error = error as? SolanaSwift.APIClientError {
switch error {
case .responseError(let error) where error.data?.logs?.contains("Program log: Error: InvalidAccountData") == true:
return true
default:
break
}
}

return false
},
maxRetryCount: .max,
Expand Down

0 comments on commit c15012e

Please sign in to comment.