6270
|
1 |
"
|
|
2 |
COPYRIGHT (c) 1997 by eXept Software AG / Claus Gittinger
|
|
3 |
All Rights Reserved
|
|
4 |
|
|
5 |
This software is furnished under a license and may be used
|
|
6 |
only in accordance with the terms of that license and with the
|
|
7 |
inclusion of the above copyright notice. This software may not
|
|
8 |
be provided or otherwise made available to, or used by, any
|
|
9 |
other person. No title to or ownership of the software is
|
|
10 |
hereby transferred.
|
|
11 |
"
|
|
12 |
|
|
13 |
|
|
14 |
|
6271
|
15 |
"{ Package: 'stx:libbasic' }"
|
6270
|
16 |
|
|
17 |
Object subclass:#OSErrorHolder
|
6280
|
18 |
instanceVariableNames:'errorSymbol errorCategory'
|
6271
|
19 |
classVariableNames:'Signals OSErrorSignal'
|
6270
|
20 |
poolDictionaries:''
|
6271
|
21 |
category:'OS-Support'
|
6270
|
22 |
!
|
|
23 |
|
|
24 |
!OSErrorHolder class methodsFor:'documentation'!
|
|
25 |
|
|
26 |
copyright
|
|
27 |
"
|
|
28 |
COPYRIGHT (c) 1997 by eXept Software AG / Claus Gittinger
|
|
29 |
All Rights Reserved
|
|
30 |
|
|
31 |
This software is furnished under a license and may be used
|
|
32 |
only in accordance with the terms of that license and with the
|
|
33 |
inclusion of the above copyright notice. This software may not
|
|
34 |
be provided or otherwise made available to, or used by, any
|
|
35 |
other person. No title to or ownership of the software is
|
|
36 |
hereby transferred.
|
|
37 |
"
|
|
38 |
|
|
39 |
|
|
40 |
!
|
|
41 |
|
|
42 |
documentation
|
|
43 |
"
|
6271
|
44 |
This class represents low level operating system errors.
|
|
45 |
We do not use error numbers, because there may be different errnos
|
|
46 |
for the same error on different systems.
|
6270
|
47 |
|
6271
|
48 |
[instance variables:]
|
|
49 |
errorSymbol symbol associated with this error
|
|
50 |
errorCategory symbol defining the error category.
|
|
51 |
This is in fact a symbol that returns a
|
|
52 |
Signal when sent to myself.
|
6270
|
53 |
|
6271
|
54 |
While the errorSymbol may be different on different platforms,
|
|
55 |
the errorCategories (which refer to the Signals that will be raised)
|
|
56 |
are identical.
|
|
57 |
You can get an OS independent error message for an error by sending
|
|
58 |
#errorCategoryString.
|
|
59 |
|
|
60 |
[author:]
|
|
61 |
Stefan Vogel
|
|
62 |
|
|
63 |
[see also:]
|
|
64 |
OperatingSystem
|
6270
|
65 |
"
|
|
66 |
! !
|
|
67 |
|
6294
|
68 |
!OSErrorHolder class methodsFor:'Signal constants'!
|
|
69 |
|
6297
|
70 |
allocRetrySignal
|
|
71 |
^ Signals at:#allocRetrySignal
|
|
72 |
!
|
|
73 |
|
|
74 |
badAccessorSignal
|
|
75 |
^ Signals at:#badAccessorSignal
|
|
76 |
!
|
|
77 |
|
|
78 |
badArgumentsSignal
|
|
79 |
^ Signals at:#badArgumentsSignal
|
|
80 |
!
|
|
81 |
|
9164
|
82 |
classNotRegisteredSignal
|
|
83 |
^ Signals at:#classNotRegisteredSignal
|
|
84 |
!
|
|
85 |
|
|
86 |
coNotInitializedSignal
|
|
87 |
^ Signals at:#coNotInitializedSignal
|
|
88 |
!
|
|
89 |
|
6297
|
90 |
existingReferentSignal
|
|
91 |
^ Signals at:#existingReferentSignal
|
|
92 |
!
|
|
93 |
|
|
94 |
illegalOperationSignal
|
|
95 |
^ Signals at:#illegalOperationSignal
|
|
96 |
!
|
|
97 |
|
|
98 |
inaccessibleSignal
|
|
99 |
^ Signals at:#inaccessibleSignal
|
|
100 |
!
|
|
101 |
|
|
102 |
inappropriateOperationSignal
|
|
103 |
^ Signals at:#inappropriateOperationSignal
|
|
104 |
!
|
|
105 |
|
|
106 |
inappropriateReferentSignal
|
|
107 |
^ Signals at:#inappropriateReferentSignal
|
|
108 |
!
|
|
109 |
|
6294
|
110 |
invalidArgumentsSignal
|
|
111 |
"return the signal for invalid arguments (e.g. right class, wrong value)."
|
|
112 |
|
|
113 |
^ OsInvalidArgumentsError
|
6297
|
114 |
!
|
|
115 |
|
|
116 |
needRetrySignal
|
|
117 |
^ Signals at:#needRetrySignal
|
|
118 |
!
|
|
119 |
|
9164
|
120 |
noAggregationSignal
|
|
121 |
^ Signals at:#noAggregationSignal
|
|
122 |
!
|
|
123 |
|
6297
|
124 |
noDataSignal
|
|
125 |
^ Signals at:#noDataSignal
|
|
126 |
!
|
|
127 |
|
9164
|
128 |
noInterfaceSignal
|
|
129 |
^ Signals at:#noInterfaceSignal
|
|
130 |
!
|
|
131 |
|
6297
|
132 |
noMemorySignal
|
|
133 |
^ Signals at:#noMemorySignal
|
|
134 |
!
|
|
135 |
|
|
136 |
noPermissionsSignal
|
|
137 |
^ Signals at:#noPermissionsSignal
|
|
138 |
!
|
|
139 |
|
|
140 |
noResourcesSignal
|
|
141 |
^ Signals at:#noResourcesSignal
|
|
142 |
!
|
|
143 |
|
9179
|
144 |
noVerbsSignal
|
|
145 |
^ Signals at:#noVerbsSignal
|
|
146 |
!
|
|
147 |
|
6297
|
148 |
nonexistentSignal
|
|
149 |
"return the signal for non existing referents (i.e. device, file etc.)."
|
|
150 |
|
|
151 |
^ Signals at:#nonexistentSignal
|
|
152 |
!
|
|
153 |
|
|
154 |
notReadySignal
|
|
155 |
^ Signals at:#notReadySignal
|
|
156 |
!
|
|
157 |
|
|
158 |
peerFaultSignal
|
|
159 |
^ Signals at:#peerFaultSignal
|
|
160 |
!
|
|
161 |
|
|
162 |
rangeErrorSignal
|
|
163 |
^ Signals at:#rangeErrorSignal
|
|
164 |
!
|
|
165 |
|
9179
|
166 |
signalNamed:signalName
|
|
167 |
^ Signals at:signalName
|
|
168 |
!
|
|
169 |
|
6297
|
170 |
transferFaultSignal
|
|
171 |
^ Signals at:#transferFaultSignal
|
|
172 |
!
|
|
173 |
|
|
174 |
transientErrorSignal
|
|
175 |
^ Signals at:#transientErrorSignal
|
|
176 |
!
|
|
177 |
|
|
178 |
unavailableReferentSignal
|
|
179 |
^ Signals at:#unavailableReferentSignal
|
|
180 |
!
|
|
181 |
|
|
182 |
underSpecifiedSignal
|
|
183 |
^ Signals at:#underSpecifiedSignal
|
|
184 |
!
|
|
185 |
|
9164
|
186 |
unknownNameSignal
|
|
187 |
^ Signals at:#unknownNameSignal
|
|
188 |
!
|
|
189 |
|
6297
|
190 |
unpreparedOperationSignal
|
|
191 |
^ Signals at:#unpreparedOperationSignal
|
|
192 |
!
|
|
193 |
|
|
194 |
unsupportedOperationSignal
|
|
195 |
^ Signals at:#unsupportedOperationSignal
|
|
196 |
!
|
|
197 |
|
|
198 |
volumeFullSignal
|
|
199 |
^ Signals at:#volumeFullSignal
|
|
200 |
!
|
|
201 |
|
|
202 |
wrongSubtypeForOperationSignal
|
|
203 |
^ Signals at:#wrongSubtypeForOperationSignal
|
6294
|
204 |
! !
|
|
205 |
|
6270
|
206 |
!OSErrorHolder class methodsFor:'accessing'!
|
|
207 |
|
|
208 |
errorSignal
|
|
209 |
^ OperatingSystem errorSignal
|
|
210 |
|
|
211 |
"Created: 25.1.1997 / 18:07:55 / cg"
|
|
212 |
! !
|
|
213 |
|
6271
|
214 |
!OSErrorHolder class methodsFor:'class initialization'!
|
|
215 |
|
|
216 |
initialize
|
|
217 |
"init signals etc."
|
|
218 |
|
|
219 |
|s|
|
|
220 |
|
|
221 |
OSErrorSignal isNil ifTrue:[
|
6297
|
222 |
OSErrorSignal := OsError.
|
6271
|
223 |
OSErrorSignal notifierString:'OperatingSystem error'.
|
|
224 |
|
6297
|
225 |
Signals := Dictionary new:28.
|
6271
|
226 |
|
6297
|
227 |
OsNoResourcesError notifierString:'Not enough resources'.
|
|
228 |
Signals at:#noResourcesSignal put:OsNoResourcesError.
|
|
229 |
|
|
230 |
OsIllegalOperation notifierString:'Illegal Operation'.
|
|
231 |
Signals at:#illegalOperationSignal put:OsIllegalOperation.
|
|
232 |
|
|
233 |
OsInvalidArgumentsError notifierString:'Invalid Arguments'.
|
|
234 |
Signals at:#invalidArgumentsSignal put:OsInvalidArgumentsError.
|
|
235 |
|
|
236 |
OsInaccessibleError notifierString:'Referent inaccessible'.
|
|
237 |
Signals at:#inaccessibleSignal put:OsInaccessibleError.
|
|
238 |
|
|
239 |
OsTransferFaultError notifierString:'Transfer fault'.
|
|
240 |
Signals at:#transferFaultSignal put:OsTransferFaultError.
|
|
241 |
|
|
242 |
OsNeedRetryError notifierString:'Retry Operation'.
|
|
243 |
Signals at:#needRetrySignal put:OsNeedRetryError.
|
6271
|
244 |
|
6274
|
245 |
false ifTrue:[
|
6271
|
246 |
"/ Information signals
|
|
247 |
|
|
248 |
s := self setupSignal:#informationSignal parent:OSErrorSignal
|
|
249 |
notifier:'Information'.
|
|
250 |
self setupSignal:#operationStartedSignal parent:s
|
|
251 |
notifier:'Operation started'.
|
6297
|
252 |
].
|
6271
|
253 |
"/ Retry signals
|
|
254 |
|
6297
|
255 |
self setupSignal:#notReadySignal parent:OsNeedRetryError
|
6271
|
256 |
notifier:' -- referent not ready'.
|
6297
|
257 |
self setupSignal:#transientErrorSignal parent:OsNeedRetryError
|
6271
|
258 |
notifier:' -- transient error'.
|
6297
|
259 |
self setupSignal:#allocRetrySignal parent:OsNeedRetryError
|
6271
|
260 |
notifier:' -- allocation failure'.
|
|
261 |
|
|
262 |
"/ Resource signals
|
|
263 |
|
6297
|
264 |
self setupSignal:#noMemorySignal parent:OsNoResourcesError
|
6271
|
265 |
notifier:' -- memory'.
|
|
266 |
|
|
267 |
"/ Transfer faults
|
|
268 |
|
6297
|
269 |
self setupSignal:#noDataSignal parent:OsTransferFaultError
|
6271
|
270 |
notifier:'Data unavailable/EOF reached'.
|
6297
|
271 |
self setupSignal:#peerFaultSignal parent:OsTransferFaultError
|
6271
|
272 |
notifier:'Communication with peer failed'.
|
6297
|
273 |
self setupSignal:#volumeFullSignal parent:OsTransferFaultError
|
6271
|
274 |
notifier:'Volume full'.
|
|
275 |
|
|
276 |
"/ Inaccesible faults
|
|
277 |
|
6297
|
278 |
self setupSignal:#nonexistentSignal parent:OsInaccessibleError
|
6271
|
279 |
notifier:'File does not exist'.
|
6297
|
280 |
self setupSignal:#unavailableReferentSignal parent:OsInaccessibleError
|
6271
|
281 |
notifier:' currently'.
|
6297
|
282 |
self setupSignal:#noPermissionsSignal parent:OsInaccessibleError
|
6271
|
283 |
notifier:'Permission denied'.
|
6297
|
284 |
self setupSignal:#existingReferentSignal parent:OsInaccessibleError
|
6271
|
285 |
notifier:' -- already exists or currently in use'.
|
6297
|
286 |
self setupSignal:#inappropriateReferentSignal parent:OsInaccessibleError
|
6271
|
287 |
notifier:' -- operation inappropriate'.
|
|
288 |
|
|
289 |
"/ Illegal operations
|
|
290 |
|
6297
|
291 |
self setupSignal:#inappropriateOperationSignal parent:OsIllegalOperation
|
6271
|
292 |
notifier:'Inappropriate operation'.
|
6297
|
293 |
self setupSignal:#wrongSubtypeForOperationSignal parent:OsIllegalOperation
|
6271
|
294 |
notifier:' -- wrong subtype'.
|
6297
|
295 |
self setupSignal:#unsupportedOperationSignal parent:OsIllegalOperation
|
6271
|
296 |
notifier:' -- on this platform'.
|
6297
|
297 |
self setupSignal:#unpreparedOperationSignal parent:OsIllegalOperation
|
6271
|
298 |
notifier:' -- wrong sequence'.
|
|
299 |
|
|
300 |
"/ Illegal arguments
|
|
301 |
|
6297
|
302 |
self setupSignal:#badArgumentsSignal parent:OsInvalidArgumentsError
|
6271
|
303 |
notifier:' -- wrong class'.
|
6297
|
304 |
self setupSignal:#badAccessorSignal parent:OsInvalidArgumentsError
|
6271
|
305 |
notifier:' -- accessor invalid'.
|
6297
|
306 |
self setupSignal:#rangeErrorSignal parent:OsInvalidArgumentsError
|
6271
|
307 |
notifier:' -- out of range'.
|
6297
|
308 |
self setupSignal:#underSpecifiedSignal parent:OsInvalidArgumentsError
|
6271
|
309 |
notifier:' -- operation not fully specified'.
|
9164
|
310 |
|
|
311 |
"/ COM errors
|
|
312 |
self setupSignal:#coNotInitializedSignal parent:OsIllegalOperation
|
|
313 |
notifier:'COM not initialized'.
|
|
314 |
self setupSignal:#noInterfaceSignal parent:OsIllegalOperation
|
|
315 |
notifier:'No such interface'.
|
|
316 |
self setupSignal:#classNotRegisteredSignal parent:OsIllegalOperation
|
|
317 |
notifier:'Class not registered'.
|
|
318 |
self setupSignal:#noAggregationSignal parent:OsIllegalOperation
|
|
319 |
notifier:'No Aggregation'.
|
|
320 |
self setupSignal:#unknownNameSignal parent:OsIllegalOperation
|
|
321 |
notifier:'Unknown member name'.
|
9179
|
322 |
self setupSignal:#noVerbsSignal parent:OsIllegalOperation
|
|
323 |
notifier:'No verbs for OLE object'.
|
6271
|
324 |
].
|
|
325 |
|
|
326 |
"
|
|
327 |
OSErrorSignal := nil.
|
|
328 |
self initialize
|
|
329 |
"
|
6297
|
330 |
!
|
|
331 |
|
|
332 |
setupSignal:aSymbol parent:parentSignal notifier:aString
|
|
333 |
"setup a signal, which can be retrieved by sending aSymbol to self.
|
|
334 |
Return the new signal"
|
|
335 |
|
|
336 |
|s|
|
|
337 |
|
|
338 |
Signals at:aSymbol
|
|
339 |
put:(s := parentSignal newSignal
|
|
340 |
notifierString:aString;
|
|
341 |
nameClass:self message:aSymbol).
|
|
342 |
^ s
|
6271
|
343 |
! !
|
|
344 |
|
6270
|
345 |
!OSErrorHolder methodsFor:'accessing'!
|
|
346 |
|
6280
|
347 |
errorSymbol:sym errorCategory:typ
|
6270
|
348 |
errorSymbol := sym.
|
|
349 |
errorCategory := typ.
|
|
350 |
! !
|
|
351 |
|
6294
|
352 |
!OSErrorHolder methodsFor:'error reporting'!
|
|
353 |
|
|
354 |
reportError
|
|
355 |
"Report an error."
|
|
356 |
"Delegate to the receiver's error reporter."
|
|
357 |
|
9179
|
358 |
|signal|
|
|
359 |
|
|
360 |
"/ signal := self class perform:errorCategory.
|
|
361 |
signal := self class signalNamed:errorCategory.
|
|
362 |
signal raiseWith:self in:thisContext sender.
|
|
363 |
|
6294
|
364 |
"/ ^ self errorReporter reportOn:self
|
|
365 |
! !
|
|
366 |
|
6271
|
367 |
!OSErrorHolder methodsFor:'others'!
|
|
368 |
|
6274
|
369 |
errorString
|
6280
|
370 |
^ OperatingSystem errorStringForSymbol:errorSymbol
|
6271
|
371 |
!
|
6270
|
372 |
|
6274
|
373 |
errorSymbol
|
|
374 |
^ errorSymbol
|
6270
|
375 |
! !
|
6271
|
376 |
|
7593
|
377 |
!OSErrorHolder class methodsFor:'documentation'!
|
|
378 |
|
|
379 |
version
|
9179
|
380 |
^ '$Header: /cvs/stx/stx/libbasic/OSErrorHolder.st,v 1.10 2006-02-21 18:03:53 cg Exp $'
|
7593
|
381 |
! !
|
|
382 |
|
6271
|
383 |
OSErrorHolder initialize!
|