CATCH block - but .NET execption is shown in OE ALERT-BOX

Posted by Stefan Marquardt on 18-Feb-2013 05:27

Hello,

in our ABL .NET application we are using

- MS POS for .NET 1.12 (.NET 2.0 Framework)

- OE 10.2B (06)

- POS hardware (printer)

- routine-level on error undo, throw within all methods

- CATCH at the bottom of the call tree

- special CATCH for POS exceptions within PrintReceipt method

- OPOS 1.6 driver with XP embedded on our POS hardware

- "P4DNUDM adapter 1.13 via JavaPOS" on our Win7 development

The problem:

It's working as expected within Win7 development, the .NET exeptions (like paper empty, cover open) are thrown and catched by "catch pce as Microsoft.PointOfService.PosControlException" within PrintReceipt.

Everything else is catched in the UI base method through "catch ple as Progress.Lang.Error"

But if i run the same ABL code on the XP embedded system with older OPOS driver underneath, catch seems to be not working and instead of getting catched POS execption it's shown within an OE Alertbox and then the app hungs.

I have no idea why CATCH doesn't catch ...

Stefan

All Replies

Posted by Admin on 18-Feb-2013 14:14


It's working as expected within Win7 development, the .NET exeptions (like paper empty, cover open) are thrown and catched by "
catch pce as Microsoft.PointOfService.PosControlException" within PrintReceipt.


...

I have no idea why CATCH doesn't catch ...

Maybe the older OPOS Drivers raise a different exception?

Try CATCHing the general System.Exception instead of the PosControlException and try to output the GetType():FullName.

Maybe the error class name is actually the same, but the fully qualified name (including version, culture and public key token of the vendor) are not the same I could in principle imagine that without proper assembly probing the PosControlException thrown and the PosControlException expected by your CATCH block are not the same (in this case the Assembly version present during compilation would be expected).

Posted by Stefan Marquardt on 19-Feb-2013 01:27

Mike,

thanks for you hint, i will check this.

An external consultant ( ;-) ) added this to our application:

"catch ple as Progress.Lang.Error"

Until today i thought that this is the "ultimative CATCH" in ABL.NET or do i need a second catch for System.Exception?

Teh used assemblies from POS for .NET 1.12 are unchanged since the beginning of this project.
BTW: Unfortunately MS seems to have no interest updating this and no one in the OpenEdge world seems to use it.

This is 1:1 in the the ABL Alert-Box:

Microsoft.PointOfService.PosControlException: Method OpenDrawer threw an excecption.

The device can not perform the requested procedure.

This is 100% the exception that is in my CATCH block.

Stefan

Posted by Evan Bleicher on 21-Feb-2013 10:29

Hi Stefan:

You are correct, ... the ultimate CATCH ("catch ple as Progress.Lang.Error") should catch all errors.  You should log a call with Technical Support for this issue.

Posted by Stefan Marquardt on 21-Feb-2013 10:32

This is was i did this afternoon.

Posted by Stefan Marquardt on 27-Feb-2013 09:24

Technical Support found this "limitation" in the docs:

---------------------------------------------------------------------------------------------------

Raising errors from ABL handlers for .NET events When a .NET event is published to which you have subscribed ABL handlers (see the “Handling .NET events” section on page 2–35), if an error condition is raised from an ABL handler for the .NET event, the AVM does not throw an Exception to the .NET Common Language Runtime (CLR), but displays a message to the default output device and processing continues as if no error has occurred. Thus, if any handlers for the event have not yet run when a handler raises an error, all remaining handlers continue to run. Note: This is different from the AVM response to an error condition raised from a handler for an ABL class event. In this case, the AVM raises the error on the statement that invoked the ABL Publish( ) method on the event, and any handlers that have not yet run for the event when the error is raised do not run.

---------------------------------------------------------------------------------------------------

I can't noticed this behaviour:"and processing continues as if no error has occurred".

But now i have to catch the error in the ABL handler and "save it" anywhere for later use. (i use DialogResult as a flag for an catched error)

That's not the error handling i learned with ABL.NET or C# but it works.

OT:

Posted with IE10/Win7, first i loosed all formats of the text.

Editing solves this problem but during any edit i am loosing parts of the message (IE10 bug or Progress bug?)

This thread is closed