sigdba / sig-shared-sceptre

Shared templates for Sceptre/CloudFormation
2 stars 0 forks source link

Suppress stack trace for pydantic errors #84

Open dboitnot opened 1 year ago

dboitnot commented 1 year ago

Trap pydantic.error_wrappers.ValidationError and output the validation info without the stack trace.

dboitnot commented 1 year ago

I'm not sure this is actually possible with Sceptre as-is. The template handler is expected to return a string and doesn't really have a way to indicate an error condition without using raise and that will print a stack trace.

We might be able to solve this with a PR to the Sceptre project which defines an exception type it could trap and handle specially.

dboitnot commented 1 year ago

Apparently we can achieve this by raising a subclass of SceptreException.