00001 /*----------------------------------------------------------------------------*/ 00002 /* */ 00003 /* Copyright (c) 2004-2009 William Data Systems Ltd. and Geoff Stevens. */ 00004 /* All rights reserved. */ 00005 /* */ 00006 /* This program and the accompanying materials are made available under */ 00007 /* the terms of the Common Public License v1.0 which accompanies this */ 00008 /* distribution. A copy is also available at the following address: */ 00009 /* http://www.opensource.org/licenses/cpl1.0.php */ 00010 /* */ 00011 /* Redistribution and use in source and binary forms, with or without */ 00012 /* modification, are permitted provided that the following conditions */ 00013 /* are met: */ 00014 /* */ 00015 /* Redistributions of source code must retain the above copyright */ 00016 /* notice, this list of conditions and the following disclaimer. */ 00017 /* */ 00018 /* Redistributions in binary form must reproduce the above copyright */ 00019 /* notice, this list of conditions and the following disclaimer in the */ 00020 /* documentation and/or other materials provided with the distribution. */ 00021 /* */ 00022 /* Neither the name or trademarks of William Data Systems nor the names */ 00023 /* of its contributors may be used to endorse or promote products */ 00024 /* derived from this software without specific prior written permission. */ 00025 /* */ 00026 /* DISCLAIMER */ 00027 /* */ 00028 /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */ 00029 /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */ 00030 /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */ 00031 /* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */ 00032 /* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ 00033 /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */ 00034 /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */ 00035 /* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY */ 00036 /* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */ 00037 /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE */ 00038 /* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ 00039 /* */ 00040 /*----------------------------------------------------------------------------*/ 00041 -- generic error handler 00042 -- call when a condition is trapped 00043 -- @param cond - a condition object 00044 -- @param sigl - the special variable sigl 00045 -- @param srcline - the result of the sourceline(sigl) function 00046 ::ROUTINE conditionhandler PUBLIC 00047 use arg cond, sigl, srcline 00048 traceback = cond['TRACEBACK'] 00049 condname = cond['CONDITION'] 00050 add = cond['ADDITIONAL'] 00051 code = cond['CODE'] 00052 prog = cond['PROGRAM'] 00053 desc = cond['DESCRIPTION'] 00054 00055 did = ' ' 00056 -- say did condname 'error' code desc 'detected in' prog 00057 00058 tosay = did condname 'condition' 00059 if code <> .nil 00060 then tosay = tosay code errortext(code%1) 00061 if desc <> .nil 00062 then tosay = tosay desc 00063 if prog <> .nil 00064 then tosay = tosay 'detected in' prog 00065 00066 say tosay 00067 00068 if traceback <> .nil 00069 then do 00070 say did 'traceback:' traceback~items 00071 do i over traceback 00072 say did i 00073 end 00074 end 00075 00076 say did sigl~right(6) '*-*' srcline 00077 select 00078 when add~class = .String 00079 then do 00080 say did 'additional:' add 00081 end 00082 when add~class = .Array 00083 then do 00084 say did 'additional:' add~items 00085 do i over add 00086 say did 'additional:' i 00087 end 00088 end 00089 otherwise say did 'additional is' add~class 00090 end 00091 00092 00093 00094 00095
Generated on 31 Aug 2010 05:20:02 for RexxLiterate by 0.0.1 |