Error Handling and Logging
We described how Python and Go run and how they access the network in the previous chapter; however, we missed two important points when building our network automation solution: how we report program execution events and how we handle errors.
These two topics are not as easy as they seem, and they are, most of the time, implemented in the system poorly. Some network developers might not do it properly because of lack of knowledge, but there are also some developers that don’t do it properly because of time constraints and extra time needed for coding.
But are these activities really important? Let’s examine these in this chapter. First, let’s investigate how and why we handle errors and then why and how we do event logging.
Here are the topics we are going to cover in this chapter:
- Writing code for error handling
- Logging events
- Adding logging to your code
After reading this chapter, you will be able to...