Plan 9 from Bell Labs’s /usr/web/sources/contrib/nemo/octopus/man/2/error

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


.TH ERROR 2
.SH NAME
Error, stderr, error, panic, kill, checkload \- Error handling and diagnostics
.SH SYNOPSIS
.EX
include "error.m";
err := load Error Error->PATH;

init:	fn();
kill:	fn (pid: int, msg: string): int;
error: fn(e: string);
panic: fn(e: string);
checkload: fn[T](x: T, p: string): T;

stderr: ref Sys->FD;
.EE
.SH DESCRIPTION
.B Error
provides functions used to deal with errors that are popular. Before
any other thing,
.B init
must be called to initialize the module.
.PP
.B Kill
writes the
.I msg
given to the control file for the process identified by
.IR pid .
It returns
.B -1
upon errors.
.PP
The functions
.B error
and
.B panic
are similar. They print
the given diagnostic to standard error and
raise an expection. The second one will make
the process break, for debugging.
.PP
.I Checkload
is intented to load a module and return it, checking out
that the module did indeed load. In case of error it calls
.B error
with an appropriate message, using the second argument
as the name of the file that could not be loaded.
.PP
The global
.B stderr
is standard error, for use from other modules as well.
Beware that using
.IR pctl (2)
may leave
.B stderr
closed, despite being not null.
.SH SOURCE
.B /usr/octopus/port/lib/error.b

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].