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

Return Result for errors #130

Closed
EPashkin opened this issue Sep 28, 2015 · 4 comments
Closed

Return Result for errors #130

EPashkin opened this issue Sep 28, 2015 · 4 comments
Milestone

Comments

@EPashkin
Copy link
Member

For throwable function return value must return Result (see discussion beginning at #117 (comment)).

2 types of throwable functions:

  1. without other outs that will returns Result<(), glib::Error>
    1.1) Examples of FFI function return guint:
    gtk_builder_add_objects_from_string
    1.2) Examples of FFI function return gboolean:
    gtk_css_provider_load_from_path,
    gtk_file_chooser_add_shortcut_folder,
    gtk_file_chooser_set_current_folder_file,
    gtk_page_setup_load_file,
    gtk_print_settings_to_file
    1.3) Examples of FFI functions return something usable
    gtk_icon_info_load_icon,
    gtk_recent_info_create_app_info,
    gtk_recent_manager_lookup_item
  2. with other outs that will returns tuple(or single value) instead () on good case
    Examples:
    gtk_builder_value_from_string,
    gtk_icon_info_load_symbolic

Blocked by #103

@gkoz
Copy link
Member

gkoz commented Sep 28, 2015

The 1) would probably be Result<ActualReturnType, glib::Error>

Except, if a throwing function returns Boolean, it can just be ignored making it Result<(), glib::Error>.

A list of throwing functions, return types and annotations: https://gist.github.com/gkoz/17f2ad8a05447b235b27

@EPashkin
Copy link
Member Author

You right about return value.
Thanks for list.

@gkoz
Copy link
Member

gkoz commented Jan 9, 2016

Error has conversions impls now, solving this will bring us pretty close to complete coverage of existing gtk API.

@gkoz gkoz added this to the object_reform milestone Jan 9, 2016
@EPashkin
Copy link
Member Author

EPashkin commented Jan 9, 2016

Good, I try do it tomorrow

@homu homu closed this as completed in #187 Jan 10, 2016
homu added a commit that referenced this issue Jan 10, 2016
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

No branches or pull requests

2 participants