.. include:: ../global.rst .. _`condition types hierarchy`: Condition Types --------------- By convention, condition type names have a ``^`` prefix suggesting some higher level of intervention. There is a predicate for each condition type, without the leading ``^``, and any fields have accessors called :samp:`{type}-{field}`. The base condition type is ``^condition`` and its immediate descendent is ``^error``. :lname:`Idio` error types, ``^idio-error``, are descended from ``^error`` and add three fields: ``message``, ``location`` and ``detail``. A few instances of ``^idio-error`` are still generated, largely from the :lname:`C` code base, but most conditions are instances of more specific condition types. * ``^condition`` * ``^error`` * ``^idio-error`` (``message`` ``location`` ``detail``) * ``^read-error`` (``line`` ``position``) * ``^evaluation-error`` (``expr``) * ``^string-error`` * ``^static-error`` * ``^static-variable-error`` (``name``) * ``^static-variable-type-error`` * ``^static-function-error`` * ``^static-function-arity-error`` * ``^i/o-error`` * ``^i/o-handle-error`` (``handle``) * ``^i/o-read-error`` * ``^i/o-write-error`` * ``^i/o-closed-error`` * ``^i/o-filename-error`` (``filename``) * ``^i/o-malformed-filename-error`` * ``^i/o-file-protection-error`` * ``^i/o-file-is-read-only-error`` * ``^i/o-file-already-exists-error`` * ``^i/o-no-such-file-error`` * ``^i/o-mode-error`` (``mode``) * ``^system-error`` (``errno`` ``function``) * ``^runtime-error`` * ``^rt-syntax-error`` * ``^rt-parameter-error`` * ``^rt-parameter-type-error`` * ``^rt-const-parameter-error`` * ``^rt-parameter-value-error`` * ``^rt-parameter-nil-error`` * ``^rt-variable-error`` (``name``) * ``^rt-variable-unbound-error`` * ``^rt-dynamic-variable-error`` * ``^rt-dynamic--variable-unbound-error`` * ``^rt-environ-variable-error`` * ``^rt-environ--variable-unbound-error`` * ``^rt-computed-variable-error`` * ``^rt-computed--variable-no-accessor-error`` * ``^rt-function-error`` * ``^rt-function-arity-error`` * ``^rt-module-error`` (``module``) * ``^rt-module-unbound-error`` * ``^rt-module-symbol-unbound-error`` (``symbol``) * ``^rt-path-error`` (``name``) * ``^rt-glob-error`` (``pattern``) * ``^rt-command-error`` * ``^rt-command-argv-type-error`` (``arg``) * ``^rt-command-format-error`` (``name`` ``value``) * ``^rt-command-env-type-error`` (``name`` ``value``) * ``^rt-command-exec-error`` (``errno``) * ``^rt-command-status-error`` (``status``) * ``^rt-async-command-status-error`` * ``^rt-array-error`` (``index``) * ``^rt-hash-error`` * ``^rt-hash-key-error`` (``key``) * ``^rt-number-error`` (``number``) * ``^rt-divide-by-zero-error`` * ``^rt-bignum-error`` * ``^rt-bignum-conversion-error`` * ``^rt-C-conversion-error`` * ``^rt-fixnum-error`` * ``^rt-fixnum-conversion-error`` * ``^rt-bitset-error`` * ``^rt-bitset-bounds-error`` (``bit``) * ``^rt-bitset-size-mismatch-error`` (``size1`` ``size2``) * ``^rt-keyword-error`` (``keyword``) * ``^rt-libc-error`` * ``^rt-libc-format-error`` (``name``) * ``^rt-load-error`` (``name``) * ``^rt-regex-error`` * ``^rt-struct-error`` * ``^rt-symbol-error`` * ``^rt-vtable-unbound-error`` * ``^rt-vtable-method-unbound-error`` (``name``) * ``^rt-instance-error`` * ``^rt-instance-invocation-error`` * ``^rt-slot-not-found-error`` (``slot``) * ``^rt-signal`` (``signal``) Defining Condition Types ^^^^^^^^^^^^^^^^^^^^^^^^ Defining condition types is slightly roundabout because most of the standard condition types are defined in :lname:`C` so that the :lname:`C` code can :ref:`raise ` instances of the condition types. Furthermore, the :lname:`C` code does not need accessor functions as it can access the internals of the condition types directly. That said, the :lname:`Idio` code *does* need to have the accessor functions available otherwise it can't access the condition internals. From the :lname:`C` perspective, we have defined a condition type and we only need to have :lname:`Idio` define the predicate and accessors. This is done in :file:`lib/bootstrap/condition.idio` with calls to :ref:`define-condition-type-accessors-only `. From the :lname:`Idio` perspective, we need to define a condition type and then carry on with what the :lname:`C` condition types do. So :ref:`define-condition-type ` takes the condition type name and creates a standard predicate name and takes the field names and creates standard :samp:`{condition-name}-{field-name}` accessor names. It then calls :ref:`define-condition-type/accessors ` with these new names which creates the condition type and then calls :ref:`define-condition-type-accessors-only ` as is done for the :lname:`C` condition types. Condition Type Predicates ^^^^^^^^^^^^^^^^^^^^^^^^^ .. _`condition-type?`: .. idio:function:: condition-type? o test if `o` is a condition type :param o: object to test :return: ``#t`` if `o` is a condition type ``#f`` otherwise Condition Type Constructors ^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. _`make-condition-type`: .. idio:function:: make-condition-type name parent fields make a new condition type :param name: condition type name :type name: symbol :param parent: parent condition type :type parent: ``#n`` or condition type :param fields: field names :type fields: list of symbols :return: new condition type :rtype: condition type make a new condition type based on existing condition `parent` with fields `fields` .. _`define-condition-type`: .. idio:template:: define-condition-type name parent [fields] generate default predicate and accessor names for :ref:`define-condition-type/accessors ` :param name: condition name :type name: symbol :param parent: parent type :type parent: condition type :param fields: field data, defaults to ``#n`` :type fields: list, optional Each field in `fields` should be a tuple of the form :samp:`({field-name} {accessor-name})`. Normally :samp:`{accessor-name}` would be :samp:`{condition-name}-{field-name}`. .. _`define-condition-type/accessors`: .. idio:template:: define-condition-type/accessors name parent predicate [fields] define the condition then call :ref:`define-condition-type-accessors-only ` :param name: condition name :type name: symbol :param parent: parent type :type parent: condition type :param predicate: predicate name :type predicate: symbol :param fields: field data, defaults to ``#n`` :type fields: list, optional Each field in `fields` should be a tuple of the form :samp:`({field-name} {accessor-name})`. Normally :samp:`{accessor-name}` would be :samp:`{condition-name}-{field-name}`. .. _`define-condition-type-accessors-only`: .. idio:template:: define-condition-type-accessors-only name parent predicate [fields] define the condition predicate and accessors :param name: condition name :type name: symbol :param parent: parent type :type parent: condition type :param predicate: predicate name :type predicate: symbol :param fields: field data, defaults to ``#n`` :type fields: list, optional Each field in `fields` should be a tuple of the form :samp:`({field-name} {accessor-name})`. Normally :samp:`{accessor-name}` would be :samp:`{condition-name}-{field-name}`. Condition Types Hierarchy ^^^^^^^^^^^^^^^^^^^^^^^^^ .. _`^condition`: .. idio:condition:: ^condition .. _`condition?`: .. idio:function:: condition? o test if `o` is a condition :param o: object to test :return: ``#t`` if `o` is a condition ``#f`` otherwise .. _`^error`: .. idio:condition:: ^error :parent: ^condition .. _`error?`: .. idio:function:: error? arg/48 .. _`^idio-error`: .. idio:condition:: ^idio-error :parent: ^error :field: message :field: location :field: detail * `message` * `location` * `detail` .. _`idio-error?`: .. idio:function:: idio-error? arg/49 .. _`idio-error-message`: .. idio:function:: idio-error-message arg/49 .. _`idio-error-location`: .. idio:function:: idio-error-location arg/49 .. _`idio-error-detail`: .. idio:function:: idio-error-detail arg/49 .. _`^read-error`: .. idio:condition:: ^read-error :parent: ^idio-error :field: message :field: location :field: detail :field: line :field: position .. _`read-error?`: .. idio:function:: read-error? arg/62 .. _`read-error-line`: .. idio:function:: read-error-line arg/62 .. _`read-error-position`: .. idio:function:: read-error-position arg/62 .. _`^evaluation-error`: .. idio:condition:: ^evaluation-error :parent: ^idio-error :field: message :field: location :field: detail :field: expr .. _`evaluation-error?`: .. idio:function:: evaluation-error? arg/63 .. _`evaluation-error-expr`: .. idio:function:: evaluation-error-expr arg/63 .. _`^string-error`: .. idio:condition:: ^string-error :parent: ^idio-error :field: message :field: location :field: detail .. _`string-error?`: .. idio:function:: string-error? arg/64 .. _`^static-error`: .. idio:condition:: ^static-error :parent: ^idio-error :field: message :field: location :field: detail .. _`static-error?`: .. idio:function:: static-error? arg/66 .. _`^st-variable-error`: .. idio:condition:: ^st-variable-error :parent: ^static-error :field: message :field: location :field: detail :field: name .. _`st-variable-error?`: .. idio:function:: st-variable-error? arg/67 .. _`st-variable-error-name`: .. idio:function:: st-variable-error-name arg/67 .. _`^st-variable-type-error`: .. idio:condition:: ^st-variable-type-error :parent: ^st-variable-error :field: message :field: location :field: detail :field: name .. _`st-variable-type-error?`: .. idio:function:: st-variable-type-error? arg/68 .. _`^st-function-error`: .. idio:condition:: ^st-function-error :parent: ^static-error :field: message :field: location :field: detail .. _`st-function-error?`: .. idio:function:: st-function-error? arg/69 .. _`st-function-arity-error?`: .. idio:function:: st-function-arity-error? arg/70 .. _`^st-function-arity-error`: .. idio:condition:: ^st-function-arity-error :parent: ^st-function-error :field: message :field: location :field: detail .. _`^i/o-error`: .. idio:condition:: ^i/o-error :parent: ^idio-error :field: message :field: location :field: detail .. _`i/o-error?`: .. idio:function:: i/o-error? arg/50 .. _`^i/o-handle-error`: .. idio:condition:: ^i/o-handle-error :parent: ^i/o-error :field: message :field: location :field: detail :field: handle .. _`i/o-handle-error?`: .. idio:function:: i/o-handle-error? arg/51 .. _`i/o-handle-error-handle`: .. idio:function:: i/o-handle-error-handle arg/51 .. _`^i/o-read-error`: .. idio:condition:: ^i/o-read-error :parent: ^i/o-handle-error :field: message :field: location :field: detail :field: handle .. _`i/o-read-error?`: .. idio:function:: i/o-read-error? arg/52 .. _`^i/o-write-error`: .. idio:condition:: ^i/o-write-error :parent: ^i/o-handle-error :field: message :field: location :field: detail :field: handle .. _`i/o-write-error?`: .. idio:function:: i/o-write-error? arg/53 .. _`^i/o-closed-error`: .. idio:condition:: ^i/o-closed-error :parent: ^i/o-handle-error :field: message :field: location :field: detail :field: handle .. _`i/o-closed-error?`: .. idio:function:: i/o-closed-error? arg/54 .. _`^i/o-filename-error`: .. idio:condition:: ^i/o-filename-error :parent: ^i/o-error :field: message :field: location :field: detail :field: filename .. _`i/o-filename-error?`: .. idio:function:: i/o-filename-error? arg/55 .. _`i/o-filename-error-filename`: .. idio:function:: i/o-filename-error-filename arg/55 .. _`^i/o-malformed-filename-error`: .. idio:condition:: ^i/o-malformed-filename-error :parent: ^i/o-filename-error :field: message :field: location :field: detail :field: filename .. _`i/o-malformed-filename-error?`: .. idio:function:: i/o-malformed-filename-error? arg/57 .. _`^i/o-file-protection-error`: .. idio:condition:: ^i/o-file-protection-error :parent: ^i/o-filename-error :field: message :field: location :field: detail :field: filename .. _`i/o-file-protection-error?`: .. idio:function:: i/o-file-protection-error? arg/58 .. _`^i/o-file-is-read-only-error`: .. idio:condition:: ^i/o-file-is-read-only-error :parent: ^i/o-file-protection-error :field: message :field: location :field: detail :field: filename .. _`i/o-file-is-read-only-error?`: .. idio:function:: i/o-file-is-read-only-error? arg/59 .. _`^i/o-file-already-exists-error`: .. idio:condition:: ^i/o-file-already-exists-error :parent: ^i/o-filename-error :field: message :field: location :field: detail :field: filename .. _`i/o-file-already-exists-error?`: .. idio:function:: i/o-file-already-exists-error? arg/60 .. _`^i/o-no-such-file-error`: .. idio:condition:: ^i/o-no-such-file-error :parent: ^i/o-filename-error :field: message :field: location :field: detail :field: filename .. _`i/o-no-such-file-error?`: .. idio:function:: i/o-no-such-file-error? arg/61 .. _`^i/o-mode-error`: .. idio:condition:: ^i/o-mode-error :parent: ^i/o-error :field: message :field: location :field: detail :field: mode .. _`i/o-mode-error?`: .. idio:function:: i/o-mode-error? arg/56 .. _`i/o-mode-error-mode`: .. idio:function:: i/o-mode-error-mode arg/56 .. _`^system-error`: .. idio:condition:: ^system-error :parent: ^idio-error :field: message :field: location :field: detail :field: errno :field: function :field: args .. _`system-error?`: .. idio:function:: system-error? arg/65 .. _`system-error-errno`: .. idio:function:: system-error-errno arg/65 .. _`system-error-function`: .. idio:function:: system-error-function arg/65 .. _`^runtime-error`: .. idio:condition:: ^runtime-error :parent: ^idio-error :field: message :field: location :field: detail .. _`runtime-error?`: .. idio:function:: runtime-error? arg/71 .. _`^rt-syntax-error`: .. idio:condition:: ^rt-syntax-error :parent: ^runtime-error :field: message :field: location :field: detail .. _`rt-syntax-error?`: .. idio:function:: rt-syntax-error? arg/72 .. _`^rt-parameter-error`: .. idio:condition:: ^rt-parameter-error :parent: ^runtime-error :field: message :field: location :field: detail .. _`rt-parameter-error?`: .. idio:function:: rt-parameter-error? arg/73 .. _`^rt-parameter-type-error`: .. idio:condition:: ^rt-parameter-type-error :parent: ^rt-parameter-error :field: message :field: location :field: detail .. _`rt-parameter-type-error?`: .. idio:function:: rt-parameter-type-error? arg/74 .. _`^rt-const-parameter-error`: .. idio:condition:: ^rt-const-parameter-error :parent: ^rt-parameter-error :field: message :field: location :field: detail .. _`rt-const-parameter-error?`: .. idio:function:: rt-const-parameter-error? arg/75 .. _`^rt-parameter-value-error`: .. idio:condition:: ^rt-parameter-value-error :parent: ^rt-parameter-error :field: message :field: location :field: detail .. _`rt-parameter-value-error?`: .. idio:function:: rt-parameter-value-error? arg/76 .. _`^rt-parameter-nil-error`: .. idio:condition:: ^rt-parameter-nil-error :parent: ^rt-parameter-value-error :field: message :field: location :field: detail .. _`rt-parameter-nil-error?`: .. idio:function:: rt-parameter-nil-error? arg/77 .. _`^rt-variable-error`: .. idio:condition:: ^rt-variable-error :parent: ^runtime-error :field: message :field: location :field: detail :field: name .. _`rt-variable-error?`: .. idio:function:: rt-variable-error? arg/78 .. _`rt-variable-error-name`: .. idio:function:: rt-variable-error-name arg/78 .. _`^rt-variable-unbound-error`: .. idio:condition:: ^rt-variable-unbound-error :parent: ^rt-variable-error :field: message :field: location :field: detail :field: name .. _`rt-variable-unbound-error?`: .. idio:function:: rt-variable-unbound-error? arg/79 .. _`^rt-dynamic-variable-error`: .. idio:condition:: ^rt-dynamic-variable-error :parent: ^rt-variable-error :field: message :field: location :field: detail :field: name .. _`rt-dynamic-variable-error?`: .. idio:function:: rt-dynamic-variable-error? arg/80 .. _`^rt-dynamic-variable-unbound-error`: .. idio:condition:: ^rt-dynamic-variable-unbound-error :parent: ^rt-dynamic-variable-error :field: message :field: location :field: detail :field: name .. _`rt-dynamic-variable-unbound-error?`: .. idio:function:: rt-dynamic-variable-unbound-error? arg/81 .. _`^rt-environ-variable-error`: .. idio:condition:: ^rt-environ-variable-error :parent: ^rt-variable-error :field: message :field: location :field: detail :field: name .. _`rt-environ-variable-error?`: .. idio:function:: rt-environ-variable-error? arg/82 .. _`^rt-environ-variable-unbound-error`: .. idio:condition:: ^rt-environ-variable-unbound-error :parent: ^rt-environ-variable-error :field: message :field: location :field: detail :field: name .. _`rt-environ-variable-unbound-error?`: .. idio:function:: rt-environ-variable-unbound-error? arg/83 .. _`^rt-computed-variable-error`: .. idio:condition:: ^rt-computed-variable-error :parent: ^rt-variable-error :field: message :field: location :field: detail :field: name .. _`rt-computed-variable-error?`: .. idio:function:: rt-computed-variable-error? arg/84 .. _`^rt-computed-variable-no-accessor-error`: .. idio:condition:: ^rt-computed-variable-no-accessor-error :parent: ^rt-computed-variable-error :field: message :field: location :field: detail :field: name .. _`rt-computed-variable-no-accessor-error?`: .. idio:function:: rt-computed-variable-no-accessor-error? arg/85 .. _`^rt-function-error`: .. idio:condition:: ^rt-function-error :parent: ^runtime-error :field: message :field: location :field: detail .. _`rt-function-error?`: .. idio:function:: rt-function-error? arg/86 .. _`^rt-function-arity-error`: .. idio:condition:: ^rt-function-arity-error :parent: ^rt-function-error :field: message :field: location :field: detail .. _`rt-function-arity-error?`: .. idio:function:: rt-function-arity-error? arg/87 .. _`^rt-module-error`: .. idio:condition:: ^rt-module-error :parent: ^runtime-error :field: message :field: location :field: detail :field: module .. _`rt-module-error?`: .. idio:function:: rt-module-error? arg/88 .. _`rt-module-error-module`: .. idio:function:: rt-module-error-module arg/88 .. _`^rt-module-unbound-error`: .. idio:condition:: ^rt-module-unbound-error :parent: ^rt-module-error :field: message :field: location :field: detail :field: module .. _`rt-module-unbound-error?`: .. idio:function:: rt-module-unbound-error? arg/89 .. _`^rt-module-symbol-unbound-error`: .. idio:condition:: ^rt-module-symbol-unbound-error :parent: ^rt-module-error :field: message :field: location :field: detail :field: module :field: symbol .. _`rt-module-symbol-unbound-error?`: .. idio:function:: rt-module-symbol-unbound-error? arg/90 .. _`rt-module-symbol-unbound-error-symbol`: .. idio:function:: rt-module-symbol-unbound-error-symbol arg/90 .. _`^rt-path-error`: .. idio:condition:: ^rt-path-error :parent: ^runtime-error :field: message :field: location :field: detail :field: pathname .. _`rt-path-error?`: .. idio:function:: rt-path-error? arg/91 .. _`rt-path-error-pathname`: .. idio:function:: rt-path-error-pathname arg/91 .. _`^rt-glob-error`: .. idio:condition:: ^rt-glob-error :parent: ^runtime-error :field: message :field: location :field: detail :field: pattern .. _`rt-glob-error?`: .. idio:function:: rt-glob-error? arg/92 .. _`rt-glob-error-pattern`: .. idio:function:: rt-glob-error-pattern arg/92 .. _`^rt-command-error`: .. idio:condition:: ^rt-command-error :parent: ^runtime-error :field: message :field: location :field: detail .. _`rt-command-error?`: .. idio:function:: rt-command-error? arg/93 .. _`^rt-command-argv-type-error`: .. idio:condition:: ^rt-command-argv-type-error :parent: ^rt-command-error :field: message :field: location :field: detail :field: arg .. _`rt-command-argv-type-error?`: .. idio:function:: rt-command-argv-type-error? arg/94 .. _`rt-command-argv-type-error-arg`: .. idio:function:: rt-command-argv-type-error-arg arg/94 .. _`^rt-command-format-error`: .. idio:condition:: ^rt-command-format-error :parent: ^rt-command-error :field: message :field: location :field: detail :field: name :field: value .. _`rt-command-format-error?`: .. idio:function:: rt-command-format-error? arg/95 .. _`rt-command-format-error-name`: .. idio:function:: rt-command-format-error-name arg/95 .. _`rt-command-format-error-value`: .. idio:function:: rt-command-format-error-value arg/95 .. _`^rt-command-env-type-error`: .. idio:condition:: ^rt-command-env-type-error :parent: ^rt-command-error :field: message :field: location :field: detail :field: name :field: value .. _`rt-command-env-type-error?`: .. idio:function:: rt-command-env-type-error? arg/96 .. _`rt-command-env-type-error-name`: .. idio:function:: rt-command-env-type-error-name arg/96 .. _`rt-command-env-type-error-value`: .. idio:function:: rt-command-env-type-error-value arg/96 .. _`^rt-command-exec-error`: .. idio:condition:: ^rt-command-exec-error :parent: ^rt-command-error :field: message :field: location :field: detail :field: errno .. _`rt-command-exec-error?`: .. idio:function:: rt-command-exec-error? arg/97 .. _`rt-command-exec-error-errno`: .. idio:function:: rt-command-exec-error-errno arg/97 .. _`^rt-command-status-error`: .. idio:condition:: ^rt-command-status-error :parent: ^rt-command-error :field: message :field: location :field: detail :field: status * `location` is set to be the job that failed such that you might: .. code-block:: idio job := idio-error-location c format-job-detail job * `status` is the Unix *status* value You will need to use the `libc` functions :ref:`libc/WIFEXITED `, :ref:`libc/WEXITSTATUS ` etc. to decode it. .. _`rt-command-status-error?`: .. idio:function:: rt-command-status-error? arg/98 .. _`rt-command-status-error-status`: .. idio:function:: rt-command-status-error-status arg/98 .. _`^rt-async-command-status-error`: .. idio:condition:: ^rt-async-command-status-error :parent: ^rt-command-status-error :field: message :field: location :field: detail :field: status * `location` is set to be the job that failed such that you might: .. code-block:: idio job := idio-error-location c format-job-detail job * `status` is the Unix *status* value You will need to use the `libc` functions :ref:`libc/WIFEXITED `, :ref:`libc/WEXITSTATUS ` etc. to decode it. .. _`rt-async-command-status-error?`: .. idio:function:: rt-async-command-status-error? arg/99 .. _`^rt-array-error`: .. idio:condition:: ^rt-array-error :parent: ^runtime-error :field: message :field: location :field: detail :field: index .. _`rt-array-error?`: .. idio:function:: rt-array-error? arg/100 .. _`rt-array-error-index`: .. idio:function:: rt-array-error-index arg/100 .. _`^rt-hash-error`: .. idio:condition:: ^rt-hash-error :parent: ^runtime-error :field: message :field: location :field: detail .. _`rt-hash-error?`: .. idio:function:: rt-hash-error? arg/101 .. _`^rt-hash-key-not-found-error`: .. idio:condition:: ^rt-hash-key-not-found-error :parent: ^rt-hash-error :field: message :field: location :field: detail :field: key .. _`rt-hash-key-not-found-error?`: .. idio:function:: rt-hash-key-not-found-error? arg/102 .. _`rt-hash-key-not-found-error-key`: .. idio:function:: rt-hash-key-not-found-error-key arg/102 .. _`^rt-number-error`: .. idio:condition:: ^rt-number-error :parent: ^runtime-error :field: message :field: location :field: detail :field: number .. _`rt-number-error?`: .. idio:function:: rt-number-error? arg/103 .. _`rt-number-error-number`: .. idio:function:: rt-number-error-number arg/103 .. _`^rt-divide-by-zero-error`: .. idio:condition:: ^rt-divide-by-zero-error :parent: ^rt-number-error :field: message :field: location :field: detail :field: number .. _`rt-divide-by-zero-error?`: .. idio:function:: rt-divide-by-zero-error? arg/104 .. _`^rt-bignum-error`: .. idio:condition:: ^rt-bignum-error :parent: ^rt-number-error :field: message :field: location :field: detail :field: number .. _`rt-bignum-error?`: .. idio:function:: rt-bignum-error? arg/105 .. _`^rt-bignum-conversion-error`: .. idio:condition:: ^rt-bignum-conversion-error :parent: ^rt-bignum-error :field: message :field: location :field: detail :field: number .. _`rt-bignum-conversion-error?`: .. idio:function:: rt-bignum-conversion-error? arg/106 .. _`^rt-C-conversion-error`: .. idio:condition:: ^rt-C-conversion-error :parent: ^rt-number-error :field: message :field: location :field: detail :field: number .. _`rt-C-conversion-error?`: .. idio:function:: rt-C-conversion-error? arg/107 .. _`^rt-fixnum-error`: .. idio:condition:: ^rt-fixnum-error :parent: ^rt-number-error :field: message :field: location :field: detail :field: number .. _`rt-fixnum-error?`: .. idio:function:: rt-fixnum-error? arg/108 .. _`^rt-fixnum-conversion-error`: .. idio:condition:: ^rt-fixnum-conversion-error :parent: ^rt-fixnum-error :field: message :field: location :field: detail :field: number .. _`rt-fixnum-conversion-error?`: .. idio:function:: rt-fixnum-conversion-error? arg/109 .. _`^rt-bitset-error`: .. idio:condition:: ^rt-bitset-error :parent: ^runtime-error :field: message :field: location :field: detail .. _`rt-bitset-error?`: .. idio:function:: rt-bitset-error? arg/110 .. _`^rt-bitset-bounds-error`: .. idio:condition:: ^rt-bitset-bounds-error :parent: ^rt-bitset-error :field: message :field: location :field: detail :field: bit .. _`rt-bitset-bounds-error?`: .. idio:function:: rt-bitset-bounds-error? arg/111 .. _`rt-bitset-bounds-error-bit`: .. idio:function:: rt-bitset-bounds-error-bit arg/111 .. _`^rt-bitset-size-mismatch-error`: .. idio:condition:: ^rt-bitset-size-mismatch-error :parent: ^rt-bitset-error :field: message :field: location :field: detail :field: size1 :field: size2 .. _`rt-bitset-size-mismatch-error?`: .. idio:function:: rt-bitset-size-mismatch-error? arg/112 .. _`rt-bitset-size-mismatch-error-size1`: .. idio:function:: rt-bitset-size-mismatch-error-size1 arg/112 .. _`rt-bitset-size-mismatch-error-size2`: .. idio:function:: rt-bitset-size-mismatch-error-size2 arg/112 .. _`^rt-keyword-error`: .. idio:condition:: ^rt-keyword-error :parent: ^runtime-error :field: message :field: location :field: detail :field: keyword .. _`rt-keyword-error?`: .. idio:function:: rt-keyword-error? arg/113 .. _`rt-keyword-error-keyword`: .. idio:function:: rt-keyword-error-keyword arg/113 .. _`^rt-libc-error`: .. idio:condition:: ^rt-libc-error :parent: ^runtime-error :field: message :field: location :field: detail .. _`rt-libc-error?`: .. idio:function:: rt-libc-error? arg/114 .. _`^rt-libc-format-error`: .. idio:condition:: ^rt-libc-format-error :parent: ^rt-libc-error :field: message :field: location :field: detail :field: name .. _`rt-libc-format-error?`: .. idio:function:: rt-libc-format-error? arg/115 .. _`rt-libc-format-error-name`: .. idio:function:: rt-libc-format-error-name arg/115 .. _`^rt-load-error`: .. idio:condition:: ^rt-load-error :parent: ^runtime-error :field: message :field: location :field: detail :field: filename .. _`rt-load-error?`: .. idio:function:: rt-load-error? arg/119 .. _`rt-load-error-filename`: .. idio:function:: rt-load-error-filename arg/119 .. _`^rt-regex-error`: .. idio:condition:: ^rt-regex-error :parent: ^rt-libc-error :field: message :field: location :field: detail .. _`rt-regex-error?`: .. idio:function:: rt-regex-error? arg/116 .. _`^rt-struct-error`: .. idio:condition:: ^rt-struct-error :parent: ^runtime-error :field: message :field: location :field: detail .. _`rt-struct-error?`: .. idio:function:: rt-struct-error? arg/117 .. _`^rt-symbol-error`: .. idio:condition:: ^rt-symbol-error :parent: ^runtime-error :field: message :field: location :field: detail .. _`rt-symbol-error?`: .. idio:function:: rt-symbol-error? arg/118 .. _`^rt-signal`: .. idio:condition:: ^rt-signal :parent: ^error :field: signum .. _`rt-signal?`: .. idio:function:: rt-signal? arg/125 .. _`rt-signal-signal`: .. idio:function:: rt-signal-signal arg/125 .. _`^rt-vtable-unbound-error`: .. idio:condition:: ^rt-vtable-unbound-error :parent: ^runtime-error :field: message :field: location :field: detail .. _`rt-vtable-unbound-error?`: .. idio:function:: rt-vtable-unbound-error? arg/120 .. _`^rt-vtable-method-unbound-error`: .. idio:condition:: ^rt-vtable-method-unbound-error :parent: ^runtime-error :field: message :field: location :field: detail :field: name .. _`rt-vtable-method-unbound-error?`: .. idio:function:: rt-vtable-method-unbound-error? arg/121 .. _`rt-vtable-method-unbound-error-name`: .. idio:function:: rt-vtable-method-unbound-error-name arg/121 .. _`^rt-instance-error`: .. idio:condition:: ^rt-instance-error :parent: ^runtime-error :field: message :field: location :field: detail .. _`rt-instance-error?`: .. idio:function:: rt-instance-error? arg/122 .. _`^rt-instance-invocation-error`: .. idio:condition:: ^rt-instance-invocation-error :parent: ^rt-instance-error :field: message :field: location :field: detail .. _`rt-instance-invocation-error?`: .. idio:function:: rt-instance-invocation-error? arg/123 .. _`^rt-slot-not-found-error`: .. idio:condition:: ^rt-slot-not-found-error :parent: ^rt-instance-error :field: message :field: location :field: detail :field: slot .. _`rt-slot-not-found-error?`: .. idio:function:: rt-slot-not-found-error? arg/124 .. _`rt-slot-not-found-error-slot`: .. idio:function:: rt-slot-not-found-error-slot arg/124 Condition Instances ------------------- Condition instances are struct instances whose types are descended from ``^condition``. Condition Instance Predicates ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. _`condition-isa?`: .. idio:function:: condition-isa? c ct test if condition `c` is a condition type `ct` :param c: condition to test :type c: condition :param ct: condition type to assert :type ct: condition type :return: ``#t`` if `c` is a condition type `ct`, ``#f`` otherwise Condition Instance Constructors ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. _`make-condition`: .. idio:function:: make-condition ct values initialize a condition of condition type `ct` with values `values` :param ct: condition type to allocate :type ct: condition type :param values: initial values for condition fields :type values: list :return: allocated condition :rtype: struct-instance .. _`allocate-condition`: .. idio:function:: allocate-condition ct allocate a condition of condition type `ct` :param ct: condition type to allocate :type ct: condition type :return: allocated condition :rtype: struct-instance The allocated condition will have fields set to ``#n`` Used with :ref:`condition `. .. _`condition`: .. idio:template:: condition type [field-bindings] :ref:`allocate-condition ` an instance of condition `type` and :ref:`condition-set! ` the supplied `field-bindings` :param type: condition type name :type type: symbol :param field-bindings: field data, defaults to ``#n`` :type field-bindings: list, optional Each field in `field-bindings` should be a tuple of the form :samp:`({field-name} {value})`. ``condition`` is only used in testing. Condition Instance Accessors ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. _`condition-ref`: .. idio:function:: condition-ref c field return field `field` of condition `c` :param c: condition :type c: struct-instance :param field: field to return :return: field `field` of `c` .. _`condition-set!`: .. idio:function:: condition-set! c field value set field `field` of condition `c` to value `value` :param c: condition :type c: struct-instance :param field: field to set :type field: symbol :param value: value to set :return: ``#`` Condition Instance Functions ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. _`condition-report`: .. idio:function:: condition-report prefix c [args] print a report on condition `c` :param prefix: a distinguishing string :type prefix: string :param c: the condition :type c: condition instance :param handle: print to handle, defaults to current error handle :type handle: handle, optional :return: ``#`` The form of the report is not fixed and should not be relied upon. Most reports are a single line but some, notably for :ref:`^rt-command-status-error <^rt-command-status-error>`, may be multiple lines. .. _`condition-report-extend`: .. idio:function:: condition-report-extend ct cb extend :ref:`condition-report ` to handle condition type `ct` :param ct: condition type :type ct: condition type :param cb: callback handler :type cb: 3-ary function :return: ``#`` `cb` will be invoked as :samp:`{cb} {c} iem cr-printf` where :samp:`{c}` is the condition instance, ``iem`` adds the standard ``^idio-error`` information to the report and ``cr-printf`` is a :ref:`printf `-like function to add more information to the report. .. include:: ../commit.rst