Merge pull request #2626 from AlphaWallet/tweak-error-logging4

Tweak error logging to be more granular
pull/2492/head
Vladyslav Shepitko 4 years ago committed by GitHub
commit f363da6701
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 18
      AlphaWallet/Extensions/Session+PromiseKit.swift

@ -39,6 +39,18 @@ struct NonceTooLowError: LocalizedError {
"The nonce of the transaction is too low"
}
}
struct GasPriceTooLow: LocalizedError {
var errorDescription: String? {
//TODO remove after mapping to better UI and message. Hence not localized yet
"The gas price specified for this transaction is too low"
}
}
struct GasLimitTooLow: LocalizedError {
var errorDescription: String? {
//TODO remove after mapping to better UI and message. Hence not localized yet
"The gas limit specified for this transaction is too low"
}
}
struct NetworkConnectionWasLostError: LocalizedError {
var errorDescription: String? {
//TODO remove after mapping to better UI and message. Hence not localized yet
@ -109,6 +121,12 @@ extension Session {
} else if message.lowercased().hasPrefix("nonce too low") {
RemoteLogger.instance.logRpcOrOtherWebError("JSONRPCError.responseError | code: \(code) | message: \(message) | as: NonceTooLowError()", url: baseUrl.absoluteString)
return NonceTooLowError()
} else if message.lowercased().hasPrefix("transaction underpriced") {
RemoteLogger.instance.logRpcOrOtherWebError("JSONRPCError.responseError | code: \(code) | message: \(message) | as: GasPriceTooLow()", url: baseUrl.absoluteString)
return GasPriceTooLow()
} else if message.lowercased().hasPrefix("intrinsic gas too low") {
RemoteLogger.instance.logRpcOrOtherWebError("JSONRPCError.responseError | code: \(code) | message: \(message) | as: GasLimitTooLow()", url: baseUrl.absoluteString)
return GasLimitTooLow()
} else {
RemoteLogger.instance.logRpcOrOtherWebError("JSONRPCError.responseError | code: \(code) | message: \(message)", url: baseUrl.absoluteString)
}

Loading…
Cancel
Save