4560
|
1 |
"{ Package: 'stx:libbasic2' }"
|
|
2 |
|
|
3 |
"{ NameSpace: Smalltalk }"
|
|
4 |
|
|
5 |
Notification subclass:#SocketErrorNotification
|
|
6 |
instanceVariableNames:''
|
|
7 |
classVariableNames:''
|
|
8 |
poolDictionaries:''
|
|
9 |
category:'Kernel-Exceptions-Errors'
|
|
10 |
!
|
|
11 |
|
|
12 |
!SocketErrorNotification class methodsFor:'documentation'!
|
|
13 |
|
|
14 |
documentation
|
|
15 |
"
|
|
16 |
This notification is raised, when an error in a Socket operation is detected.
|
|
17 |
It is used to have a soft transition from old code checking for false
|
|
18 |
to code catching exceptions.
|
|
19 |
|
|
20 |
[author:]
|
|
21 |
Stefan Vogel
|
|
22 |
|
|
23 |
[instance variables:]
|
|
24 |
parameter - the OSError containing the error number and error string.
|
|
25 |
|
|
26 |
[class variables:]
|
|
27 |
|
|
28 |
[see also:]
|
|
29 |
|
|
30 |
"
|
|
31 |
! !
|
|
32 |
|
|
33 |
!SocketErrorNotification methodsFor:'accessing'!
|
|
34 |
|
|
35 |
errorCategory
|
|
36 |
"return the generi OS independent error category.
|
|
37 |
return #unknown, if this is not an OS error"
|
|
38 |
|
|
39 |
|holder|
|
|
40 |
|
|
41 |
holder := self osErrorHolder.
|
|
42 |
holder isNil ifTrue:[
|
|
43 |
^ #unknown
|
|
44 |
].
|
|
45 |
^ holder errorCategory.
|
|
46 |
|
|
47 |
"Created: / 19-01-2018 / 13:41:19 / stefan"
|
|
48 |
!
|
|
49 |
|
|
50 |
errorCode
|
|
51 |
"return the generi OS independent error category.
|
|
52 |
return nil, if this is not an OS error"
|
|
53 |
|
|
54 |
|holder|
|
|
55 |
|
|
56 |
holder := self osErrorHolder.
|
|
57 |
holder isNil ifTrue:[
|
|
58 |
^ nil
|
|
59 |
].
|
|
60 |
^ holder errorCode.
|
|
61 |
|
|
62 |
"Created: / 19-01-2018 / 13:42:07 / stefan"
|
|
63 |
!
|
|
64 |
|
|
65 |
osErrorHolder
|
|
66 |
^ parameter
|
|
67 |
|
|
68 |
"Created: / 19-01-2018 / 13:39:28 / stefan"
|
4569
|
69 |
!
|
|
70 |
|
|
71 |
osErrorString
|
|
72 |
"return the generi OS independent error category.
|
|
73 |
return nil, if this is not an OS error"
|
|
74 |
|
|
75 |
|holder|
|
|
76 |
|
|
77 |
holder := self osErrorHolder.
|
|
78 |
holder isNil ifTrue:[
|
|
79 |
^ nil
|
|
80 |
].
|
|
81 |
^ holder errorString.
|
|
82 |
|
|
83 |
"Created: / 19-01-2018 / 15:42:17 / stefan"
|
4560
|
84 |
! !
|
|
85 |
|
|
86 |
!SocketErrorNotification methodsFor:'printing & storing'!
|
|
87 |
|
|
88 |
description
|
|
89 |
"lazy initialization - the text is not needed for caught exceptions"
|
|
90 |
|
|
91 |
messageText isNil ifTrue:[
|
|
92 |
self initializeMessageText
|
|
93 |
].
|
|
94 |
^ super description
|
|
95 |
!
|
|
96 |
|
|
97 |
initializeMessageText
|
|
98 |
"for lazy initialization - the text is not needed for caught exceptions"
|
|
99 |
|
|
100 |
self osErrorHolder notNil ifTrue:[
|
|
101 |
messageText := ' : ' , self osErrorHolder errorString.
|
|
102 |
].
|
|
103 |
|
|
104 |
"Modified (format): / 19-01-2018 / 13:58:29 / stefan"
|
|
105 |
!
|
|
106 |
|
|
107 |
messageText
|
|
108 |
"lazy initialization - the text is not needed for caught exceptions"
|
|
109 |
|
|
110 |
messageText isNil ifTrue:[
|
|
111 |
self initializeMessageText
|
|
112 |
].
|
|
113 |
^ messageText
|
|
114 |
! !
|
|
115 |
|
|
116 |
!SocketErrorNotification class methodsFor:'documentation'!
|
|
117 |
|
|
118 |
version
|
|
119 |
^ '$Header$'
|
|
120 |
!
|
|
121 |
|
|
122 |
version_CVS
|
|
123 |
^ '$Header$'
|
|
124 |
! !
|
|
125 |
|