From 17e3b88b541ed7f45d575f0f9caaa808cd0a6619 Mon Sep 17 00:00:00 2001 From: Yong He Date: Wed, 1 Jun 2022 17:37:07 -0700 Subject: New language feature: basic error handling. (#2253) * New language feature: basic error handling. * Fix. * Fix `tryCall` encoding according to code review. Co-authored-by: Yong He --- examples/heterogeneous-hello-world/main.slang | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'examples') diff --git a/examples/heterogeneous-hello-world/main.slang b/examples/heterogeneous-hello-world/main.slang index 2e65c7149..2a9c1eaf1 100644 --- a/examples/heterogeneous-hello-world/main.slang +++ b/examples/heterogeneous-hello-world/main.slang @@ -9,20 +9,18 @@ int MessageBoxA(Ptr hwnd, String text, String caption, uint flags); [COM] interface IObject { - int getValue(int value); + int getValue(int value) throws int; } [DllImport("test-com")] IObject createObject(); -public __extern_cpp int main() +public __extern_cpp void main() throws int { //writeln("hello world"); //MessageBoxA(nullptr, "hello world!", "example", 0); IObject object = createObject(); - int rs = object.getValue(2); - - return 0; + int rs = try object.getValue(2); } \ No newline at end of file -- cgit v1.2.3