contract TryCatchTester {
get fun testTryCatch(): Int {
try {
throw(101);
} catch (e) {
return e;
}
}
}
fails with
Func compilation error: /Users/anton_1/ton/tact/contract-throw/throw_TryCatchTester.code.fc:25:1: error: previous function return type (tuple, int) cannot be unified with implicit end-of-block return type (): cannot unify type () with (tuple, int)
}
To me it looks like a FunC issue. As a workaround, one can add something like nativeThrowUnless(1111111, false) after the try-catch statement: Tact's return reachability analysis won't complain and FunC is happy to compile the program with unreachable code.
Compilation of the following contract
fails with
To me it looks like a FunC issue. As a workaround, one can add something like
nativeThrowUnless(1111111, false)
after thetry-catch
statement: Tact's return reachability analysis won't complain and FunC is happy to compile the program with unreachable code.