Enum in ffi compiler

Error

enum Error
Import
use ffi::{Error};
Source: compiler/src/builtin_docs/ffi.hy

The error of dload, declare, invoke and read_ints.

One record variant: read e.kind (an ErrorKind) to decide what to do and e.message for a human-readable description.

Variants#

Error { kind: ErrorKind, message: string }#

The failure’s category and its message.

Examples#

use ffi::{Error, ErrorKind};
use tests::assert;
fn describe(Error e) -> string {
    return match e.kind {
        ErrorKind::LibraryNotFound => "missing library: " + e.message,
        default => e.message,
    };
}

fn main() {
    let e = Error::Error { kind: ErrorKind::LibraryNotFound, message: "demo" };
    assert!(describe(e) == "missing library: demo");
}

See also#

↑ ↓ navigate ↵ open