Corrections - Tom
Compare changes
- Tom Reclik authored
+ 0
− 3
```
```
Here, we intercept the specific exception ```DivisionZeroError``` and just print out a warning. Note that the program no longer crashes: The exception is being raised, we intercept it and do something with it. In a more elaborate program we would then do some error handling and either continue with the code, or end the program in a controlled way if we find we cannot continue in a meaningful way.
```
* We have augmented the pre-defined exception ```TypeError``` with an optional message that we can pass along to give more information about the exception or why we have raised it. It is a ```TypeError```, because we only want our function to work on specific types and one of the arguments is not of the specific type.
```
(Note: if we had used ```result```, it would not have caused an error because we have used the variable ```result``` in an earlier cell of the notebook. Since the notebook keeps its state, we would re-use that variable. As mentioned before, Jupyter notebooks are convenient - but very prone to side-effects and subtle bugs.)
```
```
```