[Pharo-project] Exception logging

Mariano Martinez Peck marianopeck at gmail.com
Mon Jan 16 22:14:54 CET 2012


On Mon, Jan 16, 2012 at 10:11 PM, Mariano Martinez Peck <
marianopeck at gmail.com> wrote:

>
>
> On Mon, Jan 16, 2012 at 7:08 PM, Stéphane Ducasse <
> stephane.ducasse at inria.fr> wrote:
>
>> Hi guys
>>
>> when I do the following
>>
>> |file|
>> [ file := StandardFileStream fileNamed: 'loglog.txt'.
>> file nextPutAll: 'Start'.
>> [ file nextPutAll: (Compiler evaluate: '55 + 88 poipuiu') asString] on:
>> Error do: [:ex | ex outer errorReportOn: file].
>> ] ensure: [file close].
>>
>> I get a pop up DNU poipuiu while I would like to get the stack on the
>> stream.
>
>
>
> Stef. If I understand correctly, ex outer will do "" Evaluate the
> enclosing exception action and return to here instead of signal if it
> resumes (see #resumeUnchecked:).""
>


Notice that #outer does a pass (kind of throw again) at the end:

outer
    "Evaluate the enclosing exception action and return to here instead of
signal if it resumes (see #resumeUnchecked:)."

    | prevOuterContext |
    self isResumable
        ifTrue: [
            prevOuterContext := outerContext.
            outerContext := thisContext contextTag ].
    self pass.




> So what you have to do is to use #signalerContext. Example:
>
>
> |file|
> [ file := StandardFileStream fileNamed: 'loglog.txt'.
> file nextPutAll: 'Start'.
> [ file nextPutAll: (Compiler evaluate: '55 + 88 adas') asString] on: Error
> do: [:ex | ex signalerContext errorReportOn: file ].
> ] ensure: [file close].
>
>
> I think that does what you need.
>
>
>
>> May be my mistake is obvious but I do not see it.
>>
>> Stef
>>
>
>
>
> --
> Mariano
> http://marianopeck.wordpress.com
>
>


-- 
Mariano
http://marianopeck.wordpress.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gforge.inria.fr/pipermail/pharo-project/attachments/20120116/3dc07b1f/attachment.htm>


More information about the Pharo-project mailing list