Question

Does Clarion 8 offer anything for exception handling? I know as of Clarion 5 there was no support for things like try / catch but that was released almost 10 years ago. I can't seem to find any info on how to recover from exceptions in C6 to C8 unless I was using Clarion# (aka Clarion.NET) which I'm not. If there's definitely nothing like try / catch, are there any tricks or hacks that can be used to not have a program crash when an exception is thrown even if it goes unhandled?

If it helps, I'm using version 8.0.0.8778.

EDIT 1:

Here is some sample code for a basic program that should supposedly illustrate the feature PROP:LastChanceHook, however, I can't get it to work. When I run this program, I see the first message "Start", but then nothing happens. I've tried returning 0 or 1 from Hook but that hasn't made a difference either. Every time I run this, I have to go onto the Task Manager and end the process for the program because it's not being killed.

PROGRAM
    INCLUDE('CWEXCPT.INT'), ONCE
    MAP
        Hook(*ICWExceptionInfo), LONG
        Test(LONG,LONG)
    END
    CODE
        MESSAGE('[Sample] Start')
        SYSTEM{PROP:LastChanceHook} = ADDRESS(Hook)
        Test(10, 0) ! Intentionally causes an exception
        MESSAGE('[Sample] After Test')
        RETURN ! Tried removing this, no difference

Hook PROCEDURE(*ICWExceptionInfo info)
    CODE
        MESSAGE('[Sample] Start Hook')
        IF info &= NULL THEN RETURN 0 END
        Message('An exception!')
        RETURN 1 ! 0 = don't kill, anything > 0 = tell RTL to kill the thread

Test PROCEDURE (LONG a, LONG b)
    CODE
        a %= b
Was it helpful?

Solution

Yes, take a look at prop:LastChanceHook in the help. It may provide enough function for your needs.

In other cases, the info at this link might also be useful: http://clarionsharp.com/blog/tracking-down-those-pesky-gpfs/

In the next public build of C8 (it's presently Sept 27, 2012), the buttons on that exception display (shown at the link above) can be customized a bit.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top