Cannot catch exception from inflight ctor in test
I tried this:
pub class InflightThrower {
pub inflight operation () {
throw "Exception from inflight operation";
}
}
pub class InflightConstructorThrower {
inflight new () {
throw "Exception from inflight constructor";
}
pub inflight operation () {}
}
let constructoThrower = new InflightConstructorThrower();
let opThrower = new InflightThrower();
test "catch exception from test code" {
try {
throw "Weee";
} catch e {}
}
test "catch exception in test from inflight op" {
try {
opThrower.operation();
} catch e {}
}
test "catch exception in test from inflight ctor" {
try {
constructoThrower.operation();
} catch e {}
}
This happened:
First 2 tests passed, 3rd one failed (catch exception in test from inflight ctor)
I expected this:
All 3 tests to pass
Is there a workaround?
Not that I could find..
Anything else?
No response
Wing Version
0.61.1
Node.js Version
No response
Platform(s)
No response
Community Notes
- Please vote by adding a 👍 reaction to the issue to help us prioritize.
- If you are interested to work on this issue, please leave a comment.
Yes, that's a good point, but I am not sure if there's a reasonable way to support this. The inflight constructor is invoked implicitly (and only once) per runtime environment (e.g. cloud.Function), so I am not sure how users would express their intent to catch exceptions there.
Can you share some details about the use case? Maybe there's a way to achieve it without having to catch inflight constructor exceptions.
@eladb - he was trying to test a winglib in this PR (see the commented test in openai/openai.test.w).
Hi,
This issue hasn't seen activity in 90 days. Therefore, we are marking this issue as stale for now. It will be closed after 7 days. Feel free to re-open this issue when there's an update or relevant information to be added. Thanks!
Hi,
This issue hasn't seen activity in 90 days. Therefore, we are marking this issue as stale for now. It will be closed after 7 days. Feel free to re-open this issue when there's an update or relevant information to be added. Thanks!