Enum in task compiler

TaskError

enum TaskError
Import
use task::{TaskError};
Source: compiler/src/prelude/task.hy

Why a task or a scope did not produce its value.

Variants#

Cancelled#

The task was cancelled with Task::cancel before it finished.

Panicked(string)#

The task panicked; the payload is the panic message.

TimedOut#

timeout ran out of time before the body finished.

Examples#

use task::{scope, Scope, TaskError};
use tests::assert;
let r = scope(fn (Scope s) {
    let t = s.spawn(fn () => 1);
    t.cancel();
    return t.join();
});
let cancelled = match r {
    Result::Ok(Result::Err(TaskError::Cancelled)) => true,
    default => false,
};

See also#

↑ ↓ navigate ↵ open