nil in an exception handler?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

nil in an exception handler?

Frank Shearar-3
My update-image script has the approximate shape

    ["Do a lot of stuff"]
     WorldState addDeferredUIMessage: [SmalltalkImage current
snapshot: true andQuit: true]]
        on: Error
        do: [| e |
               FileStream stderr nextPutAll: 'Exception ' , e
className , ' raised:'; lf;
                 nextPutAll: e messageText; lf;
                 flush.
               Smalltalk snapshot: false andQuit: true]

and I'm seeing

Exception UndefinedObject raised:
UndefinedObject>>messageText

in my output. Which means, according to my eyes at least, that the
#on:do: handler is getting not an Error, but nil. That just boggles my
mind.

What should I look for to try figure out what's going wrong?

frank

Reply | Threaded
Open this post in threaded view
|

Re: nil in an exception handler?

timrowledge

On 13-08-2013, at 2:28 PM, Frank Shearar <[hidden email]> wrote:

> My update-image script has the approximate shape
>
>    ["Do a lot of stuff"]
>     WorldState addDeferredUIMessage: [SmalltalkImage current
> snapshot: true andQuit: true]]
>        on: Error



>        do: [| e |



I'm reasonably sure you should be saying
 do: [:e|

here… :var| not |var|



tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
Beware of programmers who carry screwdrivers.



Reply | Threaded
Open this post in threaded view
|

Re: nil in an exception handler?

Frank Shearar-3
On 13 August 2013 22:32, tim Rowledge <[hidden email]> wrote:

>
> On 13-08-2013, at 2:28 PM, Frank Shearar <[hidden email]> wrote:
>
>> My update-image script has the approximate shape
>>
>>    ["Do a lot of stuff"]
>>     WorldState addDeferredUIMessage: [SmalltalkImage current
>> snapshot: true andQuit: true]]
>>        on: Error
>
>
>
>>        do: [| e |
>
>
>
> I'm reasonably sure you should be saying
>  do: [:e|
>
> here… :var| not |var|

Hand me that brown paper bag, would you? No no, I'll put it on my head myself.

frank

> tim
> --
> tim Rowledge; [hidden email]; http://www.rowledge.org/tim
> Beware of programmers who carry screwdrivers.
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: nil in an exception handler?

timrowledge

On 13-08-2013, at 2:36 PM, Frank Shearar <[hidden email]> wrote:
>> I'm reasonably sure you should be saying
>> do: [:e|
>>
>> here… :var| not |var|
>
> Hand me that brown paper bag, would you? No no, I'll put it on my head myself.

Sorry, I need it for when I can't get to the Great White Telephone fast enough… not a fun day today.


tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
Useful random insult:- If what you don't know can't hurt you, she's practically invulnerable.