ts2asl icon indicating copy to clipboard operation
ts2asl copied to clipboard

validate property access to caught errors

Open OlafConijn opened this issue 2 years ago • 0 comments

typescript errors that get thrown can be caught. in typescript the type that gets caught is an instance of the error. in ASL the type that gets "caught" is a structure that looks like {Error?: string, Cause?: string}.

would be good to both:

  • create a asl.error(error, cause) function that return an instance of an AslError
  • have the asl.error(error, cause) function also ensure the error is set to the name of the Node Error. this will ensure errors in lambda functions are correctly caught
  • validate member access of the caught variable. e.g. error.something would throw even though that field exists in typescript.

OlafConijn avatar Mar 24 '22 07:03 OlafConijn