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

Update Errors in Mqtt Client #268

Merged
merged 14 commits into from
Jul 18, 2024
Merged

Update Errors in Mqtt Client #268

merged 14 commits into from
Jul 18, 2024

Conversation

xiazhvera
Copy link
Contributor

@xiazhvera xiazhvera commented Jun 11, 2024

Issue #, if available:

Description of changes:

  1. Added error space for aws-crt-swift
  2. Added a way to allow customized error message for Swift
  3. Added unwrap function to unwrap Optional

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@@ -23,6 +23,20 @@ public struct CRTError: Equatable {
self.name = String(cString: aws_error_name(self.code))
}

public init<T: BinaryInteger>(code: T, context: String?) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we still need the context string if we are generating errors from crt swift?

In the areas that are currently using context, it seems like error logging would be more appropriate. Unless we are not going to generate logs from aws-crt-swift.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I eventually decide to keep the context, as the logging for Swift is not there yet.

Copy link
Contributor

@sbSteveK sbSteveK left a comment

Choose a reason for hiding this comment

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

Unsure whether we need the context string in CommonRuntimeError. That can be changed later if we decide against it. Looks solid otherwise.

On a side note, once we do this, we need to update common to reflect the error range that aws-crt-swift is taking. (ah, you've already done it =P)

Copy link
Contributor

@waahm7 waahm7 left a comment

Choose a reason for hiding this comment

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

Added comments. I am willing to agree to disagree here. I still feel that this PR doesn't have a strong enough use case for Swift errors. The added complexity might not justify the benefits, which seem limited to a slightly better error name that might not be significant for users.

Source/AwsCommonRuntimeKit/crt/CommonRuntimeError.swift Outdated Show resolved Hide resolved
Source/AwsCommonRuntimeKit/crt/Utilities.swift Outdated Show resolved Hide resolved
Source/AwsCommonRuntimeKit/crt/Utilities.swift Outdated Show resolved Hide resolved
Source/LibNative/module.modulemap Show resolved Hide resolved
@xiazhvera xiazhvera merged commit 3ae634e into iot Jul 18, 2024
25 checks passed
@xiazhvera xiazhvera deleted the mqtt_error branch July 18, 2024 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants