|
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 |
|
15 'From Smalltalk/X, Version:4.1.4 on 11-dec-2001 at 02:52:35 pm' ! |
|
16 |
|
17 "{ Package: 'stx:libbasic' }" |
|
18 |
|
19 Object subclass:#OSErrorHolder |
|
20 instanceVariableNames:'errorSymbol errorCategory errorMessage' |
|
21 classVariableNames:'Signals OSErrorSignal' |
|
22 poolDictionaries:'' |
|
23 category:'OS-Support' |
|
24 ! |
|
25 |
|
26 !OSErrorHolder class methodsFor:'documentation'! |
|
27 |
|
28 copyright |
|
29 " |
|
30 COPYRIGHT (c) 1997 by eXept Software AG / Claus Gittinger |
|
31 All Rights Reserved |
|
32 |
|
33 This software is furnished under a license and may be used |
|
34 only in accordance with the terms of that license and with the |
|
35 inclusion of the above copyright notice. This software may not |
|
36 be provided or otherwise made available to, or used by, any |
|
37 other person. No title to or ownership of the software is |
|
38 hereby transferred. |
|
39 " |
|
40 |
|
41 |
|
42 ! |
|
43 |
|
44 documentation |
|
45 " |
|
46 This class represents low level operating system errors. |
|
47 We do not use error numbers, because there may be different errnos |
|
48 for the same error on different systems. |
|
49 |
|
50 [instance variables:] |
|
51 errorSymbol symbol associated with this error |
|
52 errorCategory symbol defining the error category. |
|
53 This is in fact a symbol that returns a |
|
54 Signal when sent to myself. |
|
55 |
|
56 While the errorSymbol may be different on different platforms, |
|
57 the errorCategories (which refer to the Signals that will be raised) |
|
58 are identical. |
|
59 You can get an OS independent error message for an error by sending |
|
60 #errorCategoryString. |
|
61 |
|
62 [author:] |
|
63 Stefan Vogel |
|
64 |
|
65 [see also:] |
|
66 OperatingSystem |
|
67 " |
|
68 ! ! |
|
69 |
|
70 !OSErrorHolder class methodsFor:'accessing'! |
|
71 |
|
72 errorSignal |
|
73 ^ OperatingSystem errorSignal |
|
74 |
|
75 "Created: 25.1.1997 / 18:07:55 / cg" |
|
76 ! |
|
77 |
|
78 invalidArgumentsSignal |
|
79 ^ OperatingSystem invalidArgumentsSignal |
|
80 |
|
81 "Created: 13.9.1997 / 10:48:21 / cg" |
|
82 ! |
|
83 |
|
84 peerFaultSignal |
|
85 ^ OperatingSystem errorSignal |
|
86 |
|
87 "Created: 25.1.1997 / 18:07:55 / cg" |
|
88 ! ! |
|
89 |
|
90 !OSErrorHolder class methodsFor:'class initialization'! |
|
91 |
|
92 initialize |
|
93 "init signals etc." |
|
94 |
|
95 |s| |
|
96 |
|
97 OSErrorSignal isNil ifTrue:[ |
|
98 OSErrorSignal := Error newSignalMayProceed:true. |
|
99 OSErrorSignal nameClass:self message:#errorSignal. |
|
100 OSErrorSignal notifierString:'OperatingSystem error'. |
|
101 |
|
102 |
|
103 Signals := Dictionary new:28. |
|
104 |
|
105 "/ Information signals |
|
106 |
|
107 s := self setupSignal:#informationSignal parent:OSErrorSignal |
|
108 notifier:'Information'. |
|
109 self setupSignal:#operationStartedSignal parent:s |
|
110 notifier:'Operation started'. |
|
111 |
|
112 "/ Retry signals |
|
113 |
|
114 s := self setupSignal:#needRetrySignal parent:OSErrorSignal |
|
115 notifier:'Retry Operation'. |
|
116 self setupSignal:#notReadySignal parent:s |
|
117 notifier:' -- referent not ready'. |
|
118 self setupSignal:#transientErrorSignal parent:s |
|
119 notifier:' -- transient error'. |
|
120 self setupSignal:#allocRetrySignal parent:s |
|
121 notifier:' -- allocation failure'. |
|
122 |
|
123 "/ Resource signals |
|
124 |
|
125 s := self setupSignal:#noResourcesSignal parent:OSErrorSignal |
|
126 notifier:'Not enough resources'. |
|
127 self setupSignal:#noMemorySignal parent:s |
|
128 notifier:' -- memory'. |
|
129 |
|
130 "/ Transfer faults |
|
131 |
|
132 s := self setupSignal:#transferFaultSignal parent:OSErrorSignal |
|
133 notifier:'Transfer fault'. |
|
134 self setupSignal:#noDataSignal parent:s |
|
135 notifier:'Data unavailable/EOF reached'. |
|
136 self setupSignal:#peerFaultSignal parent:s |
|
137 notifier:'Communication with peer failed'. |
|
138 self setupSignal:#volumeFullSignal parent:s |
|
139 notifier:'Volume full'. |
|
140 |
|
141 "/ Inaccesible faults |
|
142 |
|
143 s := self setupSignal:#inaccessibleSignal parent:OSErrorSignal |
|
144 notifier:'Referent inaccessible'. |
|
145 self setupSignal:#nonExistantSignal parent:s |
|
146 notifier:'File does not exist'. |
|
147 self setupSignal:#unavailableReferentSignal parent:s |
|
148 notifier:' currently'. |
|
149 self setupSignal:#noPermissionsSignal parent:s |
|
150 notifier:'Permission denied'. |
|
151 self setupSignal:#existingReferentSignal parent:s |
|
152 notifier:' -- already exists or currently in use'. |
|
153 self setupSignal:#inappropriateReferentSignal parent:s |
|
154 notifier:' -- operation inappropriate'. |
|
155 |
|
156 "/ Illegal operations |
|
157 |
|
158 s := self setupSignal:#illegalOperationSignal parent:OSErrorSignal |
|
159 notifier:'Illegal Operation'. |
|
160 self setupSignal:#inappropriateOperationSignal parent:s |
|
161 notifier:'Inappropriate operation'. |
|
162 self setupSignal:#wrongSubtypeForOperationSignal parent:s |
|
163 notifier:' -- wrong subtype'. |
|
164 self setupSignal:#unsupportedOperationSignal parent:s |
|
165 notifier:' -- on this platform'. |
|
166 self setupSignal:#unpreparedOperationSignal parent:s |
|
167 notifier:' -- wrong sequence'. |
|
168 |
|
169 "/ Illegal arguments |
|
170 |
|
171 s := self setupSignal:#invalidArgumentsSignal parent:OSErrorSignal |
|
172 notifier:'Invalid Arguments'. |
|
173 self setupSignal:#badArgumentsSignal parent:s |
|
174 notifier:' -- wrong class'. |
|
175 self setupSignal:#badAccessorSignal parent:s |
|
176 notifier:' -- accessor invalid'. |
|
177 self setupSignal:#rangeErrorSignal parent:s |
|
178 notifier:' -- out of range'. |
|
179 self setupSignal:#underSpecifiedSignal parent:s |
|
180 notifier:' -- operation not fully specified'. |
|
181 ]. |
|
182 |
|
183 |
|
184 " |
|
185 OSErrorSignal := nil. |
|
186 self initialize |
|
187 " |
|
188 ! ! |
|
189 |
|
190 !OSErrorHolder methodsFor:'accessing'! |
|
191 |
|
192 errorSymbol:sym errorCategory:typ errorMessage:text |
|
193 errorSymbol := sym. |
|
194 errorCategory := typ. |
|
195 errorMessage := text |
|
196 ! ! |
|
197 |
|
198 !OSErrorHolder methodsFor:'others'! |
|
199 |
|
200 errorString ^'foo' |
|
201 ! |
|
202 |
|
203 errorSymbol ^#foo |
|
204 ! ! |
|
205 |
|
206 OSErrorHolder initialize! |