MessageNotUnderstood.st
author penk
Mon, 10 Feb 2003 17:39:23 +0100
changeset 7019 6591ea303fbd
parent 6669 992abad6f5aa
child 7586 63e4900c8931
permissions -rw-r--r--
*** empty log message ***

"{ Package: 'stx:libbasic' }"

Error subclass:#MessageNotUnderstood
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'Kernel-Exceptions-Errors'
!

!MessageNotUnderstood class methodsFor:'documentation'!

documentation
"
    raised when a message is sent to an object, which is not understood
    by the receiver, and the message was not handled by a class specific
    doesNotUnderstand: handler.
"
! !

!MessageNotUnderstood class methodsFor:'queries'!

mayProceed
    "Return true, because messageNotUnderstood is proceedable (with nil)."

    ^ true
! !

!MessageNotUnderstood class methodsFor:'save evaluation'!

ignoreNotUnderstoodOf:aSelector in:aBlock
    "evaluate aBlock; if a messageNotUnderstood occurs,
     for which the message was aSelector, ignore the error
     and return.
     Other selector errors lead into the debugger.
     If no error occurs, return the blocks value"

    ^ self handle:[:ex |
        ex selector == aSelector ifFalse:[
            ex reject
        ]
    ] do:aBlock.
!

ignoreNotUnderstoodOfAny:aCollectionOfSelectors in:aBlock
    "evaluate aBlock; if a messageNotUnderstood occurs,
     for which the message was any in aCollectionOfSelectors, ignore the error
     and return.
     Other selector errors lead into the debugger.
     If no error occurs, return the blocks value"

    ^ self handle:[:ex |
        (aCollectionOfSelectors includesIdentical:ex selector) ifFalse:[
            ex reject
        ]
    ] do:aBlock.
! !

!MessageNotUnderstood methodsFor:'accessing'!

message
    ^ parameter

    "
     [
        123 perform:#foo
     ] on:MessageNotUnderstood do:[:ex |
        Transcript show:'message object: '; showCR:ex message storeString.
        Transcript show:'receiver: '; showCR:ex receiver storeString.
        Transcript show:'selector: '; showCR:ex message selector storeString.
        Transcript show:'arguments: '; showCR:ex message arguments storeString.
     ]
    "
!

receiver
    ^ originator

    "
     [
        123 perform:#foo
     ] on:MessageNotUnderstood do:[:ex |
        Transcript showCR:ex receiver
     ]
    "
!

selector
    ^ parameter selector

    "
     [
        123 perform:#foo
     ] on:MessageNotUnderstood do:[:ex |
        Transcript show:'selector: '; showCR:ex selector storeString.
     ]
    "
! !

!MessageNotUnderstood class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/libbasic/MessageNotUnderstood.st,v 1.6 2002-07-25 15:51:57 ca Exp $'
! !