-
-
Save Techcable/88808f0ff219e22f6bfd02ce1dbae0d9 to your computer and use it in GitHub Desktop.
Error stall with Error!noreturn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const ExampleError = error { Foo }; | |
fn error_helper(e: ExampleError) ExampleError!noreturn { | |
return e; | |
} | |
fn other_func(i: i64) ExampleError!*i64 { | |
if (@mod(i, 2) == 0) { | |
return @divTrunc(i, 2); | |
} else { | |
return ExampleError.Foo; | |
} | |
} | |
export fn bar(i: i64) ?*i64 { | |
return other_func(i) catch |e| { | |
error_helper(e) catch return null; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment