****************************************************************
** OOPS.PRG - main error and exception handler 
** J Osako    29 Jan 1996	'This code is cursed'
** Copyright 1996 The Used Computer Store, All Rights Reserved
****************************************************************


**********
** oops() - the master error handler

PROCEDURE oops
	PARAMETER myerrcode
** For the time being, the only error it traps is
** the 'printer not ready' code. All other errors are 
** fatal - the routine just emits an error code, records 
** it, and dies. Once the sales handler is done, 
** I'll write something to handle some common errors more 
** gracefully.

	PUBLIC snafu

	M.snafu = IIF(myerrcode != ' ', myerrcode, MESSAGE())
	DO CASE
		CASE snafu = 'Printer not ready.'
			ACTIVATE WINDOW S_O_L
			@3,1 SAY 'The printer is not responding.'
			@4,1 SAY 'Please check that it is online.'
			WAIT
			DEACTIVATE WINDOW S_O_L
			RETRY
		OTHERWISE
			INSERT INTO errecord FROM MEMVAR
			DO shutdown WITH snafu IN UCSYS.PRG
	ENDCASE
RETURN