Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Improve Exception integration #873

@badcel

Description

@badcel

Currently GLib has GException which is thrown if an error occurs in C:

public sealed partial class GException : Exception, IDisposable

GLib errors contain a domain and error code in addition to its message.

Derive from GException and create GException<T> with a property Code of type T.

The libraries define their error domains as enums which map to error domains. If an error is received we can get the domain code, map it to the corresponding enum and convert the error code into an enum value.

A user catching GException<ConvertError> can get the specific error from the Code property.

Compare the ConvertError domain: https://docs.gtk.org/glib/error.ConvertError.html

See generated ConvertError enum: https://gircore.github.io/api/GLib.ConvertError.html

Using generics could potentially be hard if the domain is unknown during compile time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions