#164 closed defect (fixed)

Resumption Re-Throw Error After Another Throw

Reported by: ajbeach Owned by:
Priority: minor Component: cfa-cc
Version: 1.0 Keywords:
Cc:

Description

This is a slightly modified version of a failing test (see resume.cfa test for the original) that removes some of the current patch syntax. Ignoring that difference this is a test case that is currently failing.

try {
    try {
        printf("throwing first exception\n");
        yin black;
        throwResume &black;
    } catchResume (yin * first) {
        printf("caught first exception\n");
        try {
            printf("throwing second exception\n");
            yang white;
            throwResume &white;
        } catchResume (yang * second) {
            printf("caught second exception\n");
        }
        throwResume;
    }
} catchResume (yin * first) {
    printf("recaught first exception\n");
} catchResume (yang * second) {
    printf("caught second exception (bad location)\n");
}

Expected output:

throwing first exception
caught first exception
throwing second exception
caught second exception 
recaught first exception

The actual output adds "(bad location)" to the second last line.

What appears to be happening is that the internal exception is being thrown from where the re-throw should be thrown, despite the fact that new handler frames have been pushed onto the stack since then.

Change History (1)

comment:1 Changed 18 months ago by ajbeach

Resolution: fixed
Status: newclosed

This has been addressed and the test case has been added.

Note: See TracTickets for help on using tickets.