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

GError support #798

Merged
merged 4 commits into from
Feb 12, 2023
Merged

GError support #798

merged 4 commits into from
Feb 12, 2023

Conversation

cameronwhite
Copy link
Contributor

@cameronwhite cameronwhite commented Feb 11, 2023

  • Add a throws flag to the model, replacing the manually added parameter
  • Generate an out ErrorOwnedHandle parameter for internal functions
  • For public functions, throw an exception if an error was returned
  • Skip properties where the getter or setter throw. We could implement this, but it only occurs in deprecated WebKit2WebExtension functions so it doesn't seem worthwhile
  • Handle name collisions between interface methods and constructors. This occurs for Gio.DBusConnection and a couple other classes, which have a new_finish constructor but also have a new_finish method from Gio.AsyncInitable
  • Remove manual bindings for Element.MakeFromUri() and Pixbuf NewFromFile() which are no longer needed.
  • Add tests for functions, methods, and constructors that throw

Fixes: #756

@cameronwhite cameronwhite force-pushed the feature/gerror branch 3 times, most recently from a878a7c to bc7a90e Compare February 11, 2023 18:30
@cameronwhite
Copy link
Contributor Author

I think this is working well now - one future TODO item I noticed is that callbacks can also have a throws flag (https://gitlab.gnome.org/GNOME/gobject-introspection/-/blob/main/docs/gir-1.2.rnc#L428) if they have a GError ** parameter

@cameronwhite cameronwhite marked this pull request as ready for review February 11, 2023 19:00
Copy link
Member

@badcel badcel left a comment

Choose a reason for hiding this comment

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

Looks pretty good already. Only 2 minor changes and one bigger one. But I think the bigger one improves the code a bit regarding readability and reuseablility and improves the GirModel.

@cameronwhite cameronwhite force-pushed the feature/gerror branch 4 times, most recently from 86c7041 to aa7e4a7 Compare February 12, 2023 05:33
…meter.

- Introduce a 'Callable' interface, which is a common base for
  constructors, methods and functions. This matches the schema and will
  make it easier to write more reusable code in the generator.
- Internal functions take an `out ErrorOwnedHandle` parameter, which maps to `GError **` for the native function

- Public functions don't expose this parameter, but instead throw an exception if an error was produced.

- Skip properties where the getter or setter throw. This only occurs in deprecated WebKit2WebExtension functions.

- Remove manual bindings for Element.MakeFromUri() and Pixbuf NewFromFile() which are no longer needed.

Fixes: #756
This occurs for Gio.DBusConnection, which has a new_finish constructor but also has a new_finish method from Gio.AsyncInitable
@cameronwhite
Copy link
Contributor Author

Thanks! Updated with the latest changes

@badcel badcel merged commit 9d0ca73 into main Feb 12, 2023
@badcel badcel deleted the feature/gerror branch February 12, 2023 19:57
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.

Properly support GError
2 participants