Why You Should Not Swallow Errors

ACM.113 Example demonstrating how swallowing errors can come back to bite

Teri Radichel
Cloud Security
Published in
11 min readNov 16, 2022

--

Part of my series on Automating Cybersecurity Metrics. Application Security. The Code.

Free Content on Jobs in Cybersecurity | Sign up for the Email List

I wrote a about error handling in my series on secure programming. I explained that it is not advisable to swallow errors, of in other words catch them in some code and not report them in any output from the application.

This post shows that CloudFormation is doing that in at least one case and how it causes problems. I wasn’t planning to write this post but I had to spend time working around the problem when I discovered it, so here you go.

When swallowing errors to ignore one type of error affects all errors

In regards to my delete script I presumed that I had not followed my own rules because I was in a hurry and being a tad lazy. Instead of checking to see if a CloudFormation stack exists before I delete it, I thought I had simply ignored errors where it didn’t exist because it was already deleted. I initially thought that was the problem. As it turns out this wasn’t my code after all.

--

--

Teri Radichel
Cloud Security

CEO 2nd Sight Lab | Penetration Testing & Assessments | AWS Hero | Masters of Infosec & Software Engineering | GSE 240 etc | IANS | SANS Difference Makers Award