Replies: 1 comment
-
The CDK has a concept of construct annotations which might be suitable. Basically something like: nodeof(this).addWarning("...");
nodeof(this).addError("..."); Then, the code above would have to be written like so: bring cloud;
class Storage {
new(count: num) {
if count < 0 {
nodeof(this).addError("Expected a non-negative number");
return this;
}
for i in 0..count {
new cloud.Bucket() as "Bucket{i}";
}
}
}
new Storage(-5); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Today in preflight Wing code, you can throw errors with the
throw
keyword:This is handy for raising all kinds of errors related to invalid infrastructure configuration. Unfortunately, since this results in an error being thrown, it's only possible to see one of these errors at a time.
If there are many errors in a program, and it's possible for them to be gracefully handled, then it would be handy to have some way to raise an error without necessarily throwing an exception. This would allow you to see multiple preflight errors (potentially still with call stacks in the error messages).
Beta Was this translation helpful? Give feedback.
All reactions