Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ olerrorhandling(3W) — SunOS 4.1.2

Media Vault

Software Library

Restoration Projects

Artifacts Sought

ERROR HANDLING IN WIDGETS(3W)  —  OLIT

SYNOPSIS

#include <Intrinsic.h>
#include <StringDefs.h>
#include <OpenLook.h>

void OlSetErrorHandler(handler)
OlErrorHandler handler;

void OlSetWarningHandler(handler)
OlWarningHandler handler;

DESCRIPTION

Messages to Standard Error

Because of the non-procedural aspect of "widget programming", there are no convenient error return conditions that an application can check.  The OPEN LOOK API relies on messages printed to the UNIX standard error channel to convey error conditions to the application programmer. 

The routines used to display these messages are the OlWarning() and OlError() routines.  Currently, these behave just like the XtWarning() and XtError() routines defined in the X Toolkit Intrinsics, but may change in the future to provide better error reporting capabilities.  Changing the Error Handling Routines

The OlSetErrorHandler() and OlSetWarningHandler() routines can be used to change the routines used for error handling.  The custom routines defined by an application should provide the following interface:

OlErrorHandler error_handler(message)
String message;
OlWarningHandler error_handler(message)
String message;

The message is a character string containing the text of the error or warning message.  Perseverance in the Face of Errors

The widgets attempt to continue running when they find error conditions if they can find a reasonable way to continue.  This allows the application programmer to find out about more than one error in a single run.  Minimally, the widgets recover from illegal values given in resources, except for illegal pointers that cannot be recognized or guarded against, and illegal access (such as trying to set a "get-only" resource).  The recovery replaces the illegal value with the default value for the resource, generates a warning message, and continues.  Unrecoverable errors generate an error message and the process terminates. 

Sun Release 4.1  —  Last change: 1/8/90

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026