From 0ba7039607cf2bcadda44dad9afe57fbd43585d0 Mon Sep 17 00:00:00 2001 From: Jenea Vranceanu Date: Sun, 26 Nov 2023 23:50:13 +0200 Subject: [PATCH] chore: error messages updated --- Sources/Web3Core/Contract/ContractProtocol.swift | 4 ++-- .../localTests/String+ExtensionTests.swift.swift | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Sources/Web3Core/Contract/ContractProtocol.swift b/Sources/Web3Core/Contract/ContractProtocol.swift index 65f254d3b..f54123554 100755 --- a/Sources/Web3Core/Contract/ContractProtocol.swift +++ b/Sources/Web3Core/Contract/ContractProtocol.swift @@ -349,7 +349,7 @@ extension DefaultContractProtocol { throw Web3Error.inputError(desc: "Make sure ABI you use contains error that can match signature: 0x\(selector.toHexString())") } default: - throw Web3Error.inputError(desc: "Invalid data count") + throw Web3Error.inputError(desc: "Given data has invalid bytes count.") } } @@ -388,7 +388,7 @@ extension DefaultContractProtocol { @discardableResult public func callStatic(_ method: String, parameters: [Any], provider: Web3Provider) async throws -> [String: Any] { guard let address = address else { - throw Web3Error.inputError(desc: "address field is missing") + throw Web3Error.inputError(desc: "RPC failed: contract is missing an address.") } guard let data = self.method(method, parameters: parameters, extraData: nil) else { throw Web3Error.dataError diff --git a/Tests/web3swiftTests/localTests/String+ExtensionTests.swift.swift b/Tests/web3swiftTests/localTests/String+ExtensionTests.swift.swift index 00d7cadb2..1a6686178 100644 --- a/Tests/web3swiftTests/localTests/String+ExtensionTests.swift.swift +++ b/Tests/web3swiftTests/localTests/String+ExtensionTests.swift.swift @@ -25,7 +25,7 @@ class StringExtensionsTest: XCTestCase { XCTAssertFalse("xyz".isHex) XCTAssertFalse("0xCAFEQ".isHex) XCTAssertFalse("R0123456789abcdefABCDEF ".isHex) - XCTAssertFalse(" R0123456789abcdefABCDEFT ".isHex) + XCTAssertFalse(" R0123456789abcdefABCDEF ".isHex) } }