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

Change NatsSubscription to a throwing AsyncSequence #79

Merged
merged 3 commits into from
Jun 6, 2024

Conversation

piotrpio
Copy link
Collaborator

@piotrpio piotrpio commented May 31, 2024

Signed-off-by: Piotr Piotrowski piotr@synadia.com

Signed-off-by: Piotr Piotrowski <piotr@synadia.com>
@Jarema
Copy link
Member

Jarema commented Jun 4, 2024

This might be good for checking - both ways actually @piotrpio

nats-io/nats-architecture-and-design#282

Signed-off-by: Piotr Piotrowski <piotr@synadia.com>
@piotrpio
Copy link
Collaborator Author

piotrpio commented Jun 4, 2024

@Jarema thanks. I added handling queue in permissions denied error (if present) and fixed request() to return a proper error type.

@Jarema
Copy link
Member

Jarema commented Jun 4, 2024

Great. Ready for review? :)

@piotrpio piotrpio marked this pull request as ready for review June 4, 2024 15:31
Copy link
Member

@Jarema Jarema left a comment

Choose a reason for hiding this comment

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

Just one change request.

@@ -33,19 +57,77 @@ public enum NatsError {
}
init(_ error: String) {
let normalizedError = error.trimWhitespacesAndApostrophes().lowercased()
Copy link
Member

Choose a reason for hiding this comment

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

we can't normalize whole error, as it can contain case-sensitive subject that publish failed to.

Look here: nats-io/nats.rs#1258

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Right, for permission violation that's not a problem here as we only use the normalized version of the error to compare to "permissions violation". I changed the .proto case to include raw error string.

Signed-off-by: Piotr Piotrowski <piotr@synadia.com>
@piotrpio piotrpio requested a review from Jarema June 6, 2024 11:48
Copy link
Member

@Jarema Jarema left a comment

Choose a reason for hiding this comment

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

LGTM!

@piotrpio piotrpio merged commit 163cc9a into main Jun 6, 2024
3 checks passed
@piotrpio piotrpio deleted the subscription-errors branch June 6, 2024 12:17
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.

2 participants