mirror of
https://github.com/sigmasternchen/crap-libs
synced 2025-03-15 15:48:56 +00:00
24 lines
420 B
C
24 lines
420 B
C
#include "try.h"
|
|
|
|
#include "../oop/oop.h"
|
|
#include "exceptions/exceptions.h"
|
|
|
|
#include <stdio.h>
|
|
|
|
void function(void) { throws(Exception_class)
|
|
|
|
throw(new Exception("This is an uncaught exception."));
|
|
}
|
|
|
|
int main(void) {
|
|
try {
|
|
throw(new Exception("This is a caught exception."));
|
|
} catch(Exception_class, Exception_t* e) {
|
|
printf("Caught: %s\n", e->msg);
|
|
e->destruct(e);
|
|
} endtry;
|
|
|
|
function();
|
|
|
|
return 0;
|
|
}
|