You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In cdk-from-cfn, the current code defines a single error named TransmuteError and all other errors are defined using one of the panic!, unimplemented!, or unreachable! macros. TransmuteError is all encompassing for any transmutation related errors such as resource translation errors, parsing errors, import instruction errors, etc. Any use of the panic!, unimplemented!, or unreachable! macro will cause the source code to panic in place. In wasm builds, this causes a non-descriptive runtime error with a message of "unreachable".
In general, our current mechanism for defining error types and messages causes several problems:
Our code is harder to debug since error types are all encompassing and too widely scoped
Error messages are too generic when they originate from the panic!, unimplemented!, or unreachable! macros
New custom error types must be implemented manually which slows down development speed and is error prone
Users don't have clear error messages that help them to effectively debug resulting in a frustrating UX and increasing issues in our queue
Task Description
Use the thiserror crate to build a new mechanism for defining errors with more specific error types and messages.
Acceptance Criteria
We have a single enum with all errors defined.
All instances of panic!, unreachable!, and unimplemented! are replaced with a well-defined error type and a descriptive message.
Unit tests have been created for each defined error.
The updated code is built to wasm and error message formatting is checked on the CLI side.
If needed, the CLI error formatting code must be updated in a follow-up PR.
Version of cdk-from-cfn is released to aws-cdk and all unit/integ tests still pass or are fixed.
Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.
Context
In cdk-from-cfn, the current code defines a single error named
TransmuteError
and all other errors are defined using one of thepanic!
,unimplemented!
, orunreachable!
macros.TransmuteError
is all encompassing for any transmutation related errors such as resource translation errors, parsing errors, import instruction errors, etc. Any use of thepanic!
,unimplemented!
, orunreachable!
macro will cause the source code to panic in place. In wasm builds, this causes a non-descriptive runtime error with a message of "unreachable".In general, our current mechanism for defining error types and messages causes several problems:
Task Description
Use the thiserror crate to build a new mechanism for defining errors with more specific error types and messages.
Acceptance Criteria
panic!
,unreachable!
, andunimplemented!
are replaced with a well-defined error type and a descriptive message.Comments:
cdklabs/cdk-from-cfn#600
The text was updated successfully, but these errors were encountered: