Chapter 10. Exception Handling: Putting out fires gets old

image with no caption

Programmers aren’t meant to be firefighters.

You’ve worked your tail off, waded through technical manuals and a few engaging Head First books, and you’ve reached the pinnacle of your profession: master programmer. But you’re still getting panicked phone calls in the middle of the night from work because your program crashes, or doesn’t behave like it’s supposed to. Nothing pulls you out of the programming groove like having to fix a strange bug...but with exception handling, you can write code to deal with problems that come up. Better yet, you can even react to those problems, and keep things running.

Brian needs his excuses to be mobile

Brian recently got reassigned to the international division. Now he flies all over the world. But he still needs to keep track of his excuses, so he installed the program you built on his laptop and takes it with him everywhere.

image with no caption

But the program isn’t working!

Brian clicks the “Random Excuse” button, and gets a pretty nasty looking error. Something about not finding his excuses. What gives?

image with no caption

Get Head First C#, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.