Skip to content

ProcessError ​

ProcessError is the structured error type for recoverable process failures.

Signatureinterface ProcessError { readonly code: string; readonly message: string }

ProcessError is an Error value and can be thrown by user-defined functions. The native exec API returns it as the Err variant of Result<ChildProcess, ProcessError>.

Fields ​

FieldTypePurpose
codestringStable ERR_PROCESS_* identifier.
messagestringHuman-readable explanation.

Usage and errors ​

tyrus
import { ChildProcess, ProcessError, exec } from "tyrus:process";

async function run(command: string): Promise<Result<i32, ProcessError>> {
    const child: ChildProcess = exec(command)?;
    return await child.wait();
}

error

tyrus
const child: ChildProcess = exec(42); 

Start-time failures include invalid arguments, unavailable pipes, a file the program is not permitted to execute (ERR_PROCESS_PERMISSION_DENIED), and an executable that cannot start for any other reason, such as a command that does not exist (ERR_PROCESS_SPAWN_FAILED). A non-zero exit code and bytes on stderr are normal process results, not ProcessError values.