Class (GI Struct)

GLib-2.0GLibVariantParseError

Error codes returned by parsing text-format GVariants.

Hierarchy (View Summary)

Index

Constructors

Properties

$gtype: GType<GLib.Error>
BASIC_TYPE_EXPECTED: number

a non-basic GLib.VariantType was given where a basic type was expected

CANNOT_INFER_TYPE: number

cannot infer the GLib.VariantType

DEFINITE_TYPE_EXPECTED: number

an indefinite GLib.VariantType was given where a definite type was expected

FAILED: number

generic error (unused)

INPUT_NOT_AT_END: number

extra data after parsing finished

INVALID_CHARACTER: number

invalid character in number or unicode escape

INVALID_FORMAT_STRING: number

not a valid GLib.Variant format string

INVALID_OBJECT_PATH: number

not a valid object path

INVALID_SIGNATURE: number

not a valid type signature

INVALID_TYPE_STRING: number

not a valid GLib.Variant type string

NO_COMMON_TYPE: number

could not find a common type for array entries

NUMBER_OUT_OF_RANGE: number

the numerical value is out of range of the given type

NUMBER_TOO_BIG: number

the numerical value is out of range for any type

RECURSION: number

variant was too deeply nested; GLib.Variant is only guaranteed to handle nesting up to 64 levels (Since: 2.64)

TYPE_ERROR: number

cannot parse as variant of the specified type

UNEXPECTED_TOKEN: number

an unexpected token was encountered

UNKNOWN_KEYWORD: number

an unknown keyword was encountered

UNTERMINATED_STRING_CONSTANT: number

unterminated string constant

VALUE_EXPECTED: number

no value given

Properties - Inherited from GLib.Error

code: number
domain: number
message: string
stack: string

Methods - Inherited from GLib.Error

  • Returns true if error matches domain and code, false otherwise. In particular, when error is null, false will be returned.

    If domain contains a FAILED (or otherwise generic) error code, you should generally not check for it explicitly, but should instead treat any not-explicitly-recognized error code as being equivalent to the FAILED code. This way, if the domain is extended in the future to provide a more specific error code for a certain case, your code will still work.

    Parameters

    • domain: number | (new (...args: any[]) => GLib.Error)

      an error domain

    • code: number

      an error code

    Returns boolean

    whether error has domain and code

  • This function registers an extended GLib.Error domain. error_type_name will be duplicated. Otherwise does the same as g_error_domain_register_static().

    Parameters

    • error_type_name: string

      string to create a GLib.Quark from

    • error_type_private_size: number

      size of the private error data in bytes

    • error_type_init: ErrorInitFunc

      function initializing fields of the private error data

    • error_type_copy: ErrorCopyFunc

      function copying fields of the private error data

    • error_type_clear: ErrorClearFunc

      function freeing fields of the private error data

    Returns number

  • This function registers an extended GLib.Error domain.

    error_type_name should not be freed. error_type_private_size must be greater than 0.

    error_type_init receives an initialized GLib.Error and should then initialize the private data.

    error_type_copy is a function that receives both original and a copy GLib.Error and should copy the fields of the private error data. The standard GLib.Error fields are already handled.

    error_type_clear receives the pointer to the error, and it should free the fields of the private error data. It should not free the struct itself though.

    Normally, it is better to use G_DEFINE_EXTENDED_ERROR(), as it already takes care of passing valid information to this function.

    Parameters

    • error_type_name: string

      static string to create a GLib.Quark from

    • error_type_private_size: number

      size of the private error data in bytes

    • error_type_init: ErrorInitFunc

      function initializing fields of the private error data

    • error_type_copy: ErrorCopyFunc

      function copying fields of the private error data

    • error_type_clear: ErrorClearFunc

      function freeing fields of the private error data

    Returns number