Skip to content

Conversation

JeneaVranceanu
Copy link
Collaborator

PR contains breaking change! Changed type of errorDescription: String to errorDescription: String?.
This change is easy to "fix" but still it's breaking.

Improved output of the error when calling error.localizedDescription and the error is of type Web3Error.

Before (useless output):

2022-11-11 17:56:25.037294+0200 xctest[49120:505590] The operation couldn’t be completed. (Core.Web3Error error 3.)

After (copied log from a test case):

2022-11-11 17:56:58.722827+0200 xctest[49218:507026] This is a custom description for the test case! web3swift 🥇

@JeneaVranceanu JeneaVranceanu added the enhancement New feature or request label Nov 11, 2022
@JeneaVranceanu JeneaVranceanu self-assigned this Nov 11, 2022
@@ -25,7 +25,7 @@ public enum Web3Error: Error {
case generalError(err: Error)
case unknownError

public var errorDescription: String {
public var errorDescription: String? {
Copy link
Collaborator Author

@JeneaVranceanu JeneaVranceanu Nov 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed type to comply with LocalizedError protocol and make localizedDescription return value from errorDescription.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thou it's a bit confusing for me when I've got error messages on my language in console. Also it's usually awfully translated. But anyway, this is must.


class Web3ErrorTests: XCTestCase {

func test_web3ErrorReturnsExpectedDescription() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is a something, but anyway it's violates camelCase convention of tests naming that is used here

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

Copy link
Collaborator

@janndriessen janndriessen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 🚀

@yaroslavyaroslav yaroslavyaroslav merged commit 827eb88 into web3swift-team:develop Nov 12, 2022
@JeneaVranceanu JeneaVranceanu deleted the fix/web3-error-output branch December 14, 2022 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants