Skip to content

Exception handler is not invoked when using Perform() #8

@pablomarx

Description

@pablomarx

The following NewtonScript code demonstrates the problem:

x := { test: func() Throw('|evt.ex.msg|, "This is my message") };

print("try x:test()\n");
try x:test() onexception |evt.ex| do Print("Caught" && CurrentException().message && "\n");

print("try Perform 'test\n");
try Perform(x, 'test, []) onexception |evt.ex| do Print("Caught" && CurrentException().message && "\n");

print("Finished!\n");

When ran under NEWT/0, the output is:

try x:test()
Caught  
try Perform 'test
Finished!

Note: No exception was caught during Perform(x, 'test, [])

Under WallyScript/NewtonScript 1.x:

Welcome to WallyScript!

      0 > x := { test: func() Throw('|evt.ex.msg|, "This is my message") };
#44139D1  {test: <CodeBlock, 0 args #4413999>}
      0 > try x:test() onexception |evt.ex| do Print("Caught" && CurrentException().message && "\n");
"Caught This is my message 
"
#2        NIL
      0 > try Perform(x, 'test, []) onexception |evt.ex| do Print("Caught" && CurrentException().message && "\n");

Stack trace:
   0 : #44139D1.test : 4
       Receiver: (vars.x)
   1 : (functions.Perform)
       Receiver: (vars)
   2 : (#4414679) <CodeBlock, 0 args #4414679> : 11
       Receiver: (vars)
"Caught This is my message 
"
#2        NIL
      0 > 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions