author | Claus Gittinger <cg@exept.de> |
Fri, 29 Aug 2003 21:08:08 +0200 | |
changeset 7584 | 2104df18c2af |
parent 6690 | 07ef28245da8 |
child 7585 | 87d76b40f897 |
permissions | -rw-r--r-- |
5947 | 1 |
"{ Package: 'stx:libbasic' }" |
2 |
||
3 |
DomainError subclass:#ZeroDivide |
|
4 |
instanceVariableNames:'' |
|
5 |
classVariableNames:'' |
|
6 |
poolDictionaries:'' |
|
6218 | 7 |
category:'Kernel-Exceptions-Errors' |
5947 | 8 |
! |
9 |
||
6218 | 10 |
!ZeroDivide class methodsFor:'documentation'! |
11 |
||
12 |
documentation |
|
13 |
" |
|
14 |
Raised when a division by zero is attempted. |
|
15 |
" |
|
7584 | 16 |
! |
17 |
||
18 |
examples |
|
19 |
" |
|
20 |
the following leads into a debugger: |
|
21 |
[exBegin] |
|
22 |
|divisor| |
|
23 |
||
24 |
divisor := 0. |
|
25 |
Transcript showCR: ( 5 / divisor ). |
|
26 |
[exEnd] |
|
27 |
||
28 |
||
29 |
the following does NOT leads into a debugger: |
|
30 |
[exBegin] |
|
31 |
|divisor| |
|
32 |
||
33 |
divisor := 0. |
|
34 |
[ |
|
35 |
Transcript showCR: ( 5 / divisor ). |
|
36 |
] on:ZeroDivide |
|
37 |
do: |
|
38 |
[ |
|
39 |
Transcript flash. |
|
40 |
] |
|
41 |
[exEnd] |
|
42 |
" |
|
6218 | 43 |
! ! |
5947 | 44 |
|
6690
07ef28245da8
notifier now initialized here
Claus Gittinger <cg@exept.de>
parents:
6218
diff
changeset
|
45 |
!ZeroDivide class methodsFor:'initialization'! |
07ef28245da8
notifier now initialized here
Claus Gittinger <cg@exept.de>
parents:
6218
diff
changeset
|
46 |
|
07ef28245da8
notifier now initialized here
Claus Gittinger <cg@exept.de>
parents:
6218
diff
changeset
|
47 |
initialize |
07ef28245da8
notifier now initialized here
Claus Gittinger <cg@exept.de>
parents:
6218
diff
changeset
|
48 |
NotifierString := 'division by zero'. |
07ef28245da8
notifier now initialized here
Claus Gittinger <cg@exept.de>
parents:
6218
diff
changeset
|
49 |
! ! |
07ef28245da8
notifier now initialized here
Claus Gittinger <cg@exept.de>
parents:
6218
diff
changeset
|
50 |
|
5947 | 51 |
!ZeroDivide methodsFor:'accessing'! |
52 |
||
53 |
dividend |
|
54 |
"Return the number that was being divided by zero." |
|
55 |
||
5969 | 56 |
^ parameter receiver |
5947 | 57 |
|
58 |
" |
|
59 |
|a b| |
|
60 |
||
61 |
a := 5. |
|
62 |
b := 0. |
|
63 |
Integer divisionByZeroSignal handle:[:ex | |
|
5969 | 64 |
Transcript showCR:('division by zero - dividend was: ' , ex dividend printString) |
5947 | 65 |
] do:[ |
66 |
a // b |
|
67 |
] |
|
68 |
" |
|
69 |
! ! |
|
70 |
||
71 |
!ZeroDivide class methodsFor:'documentation'! |
|
72 |
||
73 |
version |
|
7584 | 74 |
^ '$Header: /cvs/stx/stx/libbasic/ZeroDivide.st,v 1.5 2003-08-29 19:08:08 cg Exp $' |
5947 | 75 |
! ! |
7584 | 76 |
|
6690
07ef28245da8
notifier now initialized here
Claus Gittinger <cg@exept.de>
parents:
6218
diff
changeset
|
77 |
ZeroDivide initialize! |