How to find which was the wrong message in a Message Not Understood message?

不羁岁月 提交于 2019-12-05 21:10:21

If I DoIt that, I get a debugger. The title there is

MessageNotUnderstood: ThreadSafeTranscript>>explode

When I select the first element, I get to see the doesNotUnderstand: aMessage, where aMessage is the message

Try this:

[Transcript explode] on: MessageNotUnderstood do: [:ex| ex message selector]

The exception's message is an instance of Message. It understands selector arguments etc.

Remember that the exception is an epiphenomenon. The VM actually sends doesNotUnderstand: aMessage when a message is not understood, and the doesNotUnderstand: method in Object raises the exception. The argument to doesNotUnderstand: is a message, and is of curse the same as that in the exception. That means you can implement your own doesNotUnderstand: message in your own class if you have special requirements.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!