diff -r 3a888523e3a6 -r 077fe1f763c8 OSErrorHolder.nst --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OSErrorHolder.nst Tue Dec 11 15:22:09 2001 +0100 @@ -0,0 +1,206 @@ +" + COPYRIGHT (c) 1997 by eXept Software AG / Claus Gittinger + All Rights Reserved + + This software is furnished under a license and may be used + only in accordance with the terms of that license and with the + inclusion of the above copyright notice. This software may not + be provided or otherwise made available to, or used by, any + other person. No title to or ownership of the software is + hereby transferred. +" + + + +'From Smalltalk/X, Version:4.1.4 on 11-dec-2001 at 02:52:35 pm' ! + +"{ Package: 'stx:libbasic' }" + +Object subclass:#OSErrorHolder + instanceVariableNames:'errorSymbol errorCategory errorMessage' + classVariableNames:'Signals OSErrorSignal' + poolDictionaries:'' + category:'OS-Support' +! + +!OSErrorHolder class methodsFor:'documentation'! + +copyright +" + COPYRIGHT (c) 1997 by eXept Software AG / Claus Gittinger + All Rights Reserved + + This software is furnished under a license and may be used + only in accordance with the terms of that license and with the + inclusion of the above copyright notice. This software may not + be provided or otherwise made available to, or used by, any + other person. No title to or ownership of the software is + hereby transferred. +" + + +! + +documentation +" + This class represents low level operating system errors. + We do not use error numbers, because there may be different errnos + for the same error on different systems. + + [instance variables:] + errorSymbol symbol associated with this error + errorCategory symbol defining the error category. + This is in fact a symbol that returns a + Signal when sent to myself. + + While the errorSymbol may be different on different platforms, + the errorCategories (which refer to the Signals that will be raised) + are identical. + You can get an OS independent error message for an error by sending + #errorCategoryString. + + [author:] + Stefan Vogel + + [see also:] + OperatingSystem +" +! ! + +!OSErrorHolder class methodsFor:'accessing'! + +errorSignal + ^ OperatingSystem errorSignal + + "Created: 25.1.1997 / 18:07:55 / cg" +! + +invalidArgumentsSignal + ^ OperatingSystem invalidArgumentsSignal + + "Created: 13.9.1997 / 10:48:21 / cg" +! + +peerFaultSignal + ^ OperatingSystem errorSignal + + "Created: 25.1.1997 / 18:07:55 / cg" +! ! + +!OSErrorHolder class methodsFor:'class initialization'! + +initialize + "init signals etc." + + |s| + + OSErrorSignal isNil ifTrue:[ + OSErrorSignal := Error newSignalMayProceed:true. + OSErrorSignal nameClass:self message:#errorSignal. + OSErrorSignal notifierString:'OperatingSystem error'. + + + Signals := Dictionary new:28. + + "/ Information signals + + s := self setupSignal:#informationSignal parent:OSErrorSignal + notifier:'Information'. + self setupSignal:#operationStartedSignal parent:s + notifier:'Operation started'. + + "/ Retry signals + + s := self setupSignal:#needRetrySignal parent:OSErrorSignal + notifier:'Retry Operation'. + self setupSignal:#notReadySignal parent:s + notifier:' -- referent not ready'. + self setupSignal:#transientErrorSignal parent:s + notifier:' -- transient error'. + self setupSignal:#allocRetrySignal parent:s + notifier:' -- allocation failure'. + + "/ Resource signals + + s := self setupSignal:#noResourcesSignal parent:OSErrorSignal + notifier:'Not enough resources'. + self setupSignal:#noMemorySignal parent:s + notifier:' -- memory'. + + "/ Transfer faults + + s := self setupSignal:#transferFaultSignal parent:OSErrorSignal + notifier:'Transfer fault'. + self setupSignal:#noDataSignal parent:s + notifier:'Data unavailable/EOF reached'. + self setupSignal:#peerFaultSignal parent:s + notifier:'Communication with peer failed'. + self setupSignal:#volumeFullSignal parent:s + notifier:'Volume full'. + + "/ Inaccesible faults + + s := self setupSignal:#inaccessibleSignal parent:OSErrorSignal + notifier:'Referent inaccessible'. + self setupSignal:#nonExistantSignal parent:s + notifier:'File does not exist'. + self setupSignal:#unavailableReferentSignal parent:s + notifier:' currently'. + self setupSignal:#noPermissionsSignal parent:s + notifier:'Permission denied'. + self setupSignal:#existingReferentSignal parent:s + notifier:' -- already exists or currently in use'. + self setupSignal:#inappropriateReferentSignal parent:s + notifier:' -- operation inappropriate'. + + "/ Illegal operations + + s := self setupSignal:#illegalOperationSignal parent:OSErrorSignal + notifier:'Illegal Operation'. + self setupSignal:#inappropriateOperationSignal parent:s + notifier:'Inappropriate operation'. + self setupSignal:#wrongSubtypeForOperationSignal parent:s + notifier:' -- wrong subtype'. + self setupSignal:#unsupportedOperationSignal parent:s + notifier:' -- on this platform'. + self setupSignal:#unpreparedOperationSignal parent:s + notifier:' -- wrong sequence'. + + "/ Illegal arguments + + s := self setupSignal:#invalidArgumentsSignal parent:OSErrorSignal + notifier:'Invalid Arguments'. + self setupSignal:#badArgumentsSignal parent:s + notifier:' -- wrong class'. + self setupSignal:#badAccessorSignal parent:s + notifier:' -- accessor invalid'. + self setupSignal:#rangeErrorSignal parent:s + notifier:' -- out of range'. + self setupSignal:#underSpecifiedSignal parent:s + notifier:' -- operation not fully specified'. + ]. + + + " + OSErrorSignal := nil. + self initialize + " +! ! + +!OSErrorHolder methodsFor:'accessing'! + +errorSymbol:sym errorCategory:typ errorMessage:text + errorSymbol := sym. + errorCategory := typ. + errorMessage := text +! ! + +!OSErrorHolder methodsFor:'others'! + +errorString ^'foo' +! + +errorSymbol ^#foo +! ! + +OSErrorHolder initialize!