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

Fix Python error name regression #2240

Merged
merged 1 commit into from
Sep 20, 2024
Merged

Conversation

bendk
Copy link
Contributor

@bendk bendk commented Sep 19, 2024

I hit this one when trying to upgrade application-services to 0.28.1. It's kind of surprising that this is the first we're hearing of it, but I guess the Python bindings users are a minority.

@bendk bendk requested a review from gruberb September 19, 2024 20:37
@bendk bendk requested a review from a team as a code owner September 19, 2024 20:37
visitor.visit_error_name(&mut name);
name
})
.collect()
Copy link
Contributor Author

@bendk bendk Sep 19, 2024

Choose a reason for hiding this comment

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

This is one issue, this is a somewhat hacky field that stores error type names when we see them in "[Throws=]" UDL attributes. I think that proc-macros might have handled this correctly, but I'm not sure.

Copy link
Member

Choose a reason for hiding this comment

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

I like drain in combination with collect. I think I could have used something similar here as well!

@@ -22,7 +22,7 @@ impl CodeType for ErrorCodeType {
}

fn canonical_name(&self) -> String {
format!("Type{}", self.id)
format!("Type{}", self.type_label())
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the other issue. There were 2 paths for calculating FFI converters and they didn't use the same logic:

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe I only needed to modify ErrorCodeType::canonical_name, but it seemed safer to change all of the class-like types to use the converted name.

Copy link
Member

@gruberb gruberb left a comment

Choose a reason for hiding this comment

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

👍 LGTM

@bendk bendk merged commit 0328b45 into mozilla:main Sep 20, 2024
5 checks passed
@bendk bendk deleted the push-nlslvovtvqxq branch September 20, 2024 16:39
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