### General --- - properly tested code is not very prone to internal exceptions (i.e syntax or logical errors) - but external dependencies (i.e user input, file existence, or API request) can cause exceptions to be raised - examples of deciding between failing silently vs reporting an error - user uploads specific books that your program should parse - you should report an error if one of the books wasn't parsed - user wants a list of pre-parsed books from search filtered by user selected tags - if a book failed to parse, since the user doesn't know what books were candidates in the 1st place, failing silently makes sense ### Python --- - Stack Trace: ``` File ~/Library/Python/3.9/lib/python/site-packages/pandas/io/formats/format.py:915, in DataFrameFormatter._get_formatter(self, i) 913 if is_integer(i) and i not in self.columns: 914 i = self.columns[i] --> 915 return self.formatters.get(i, None) ``` - file path: File ~/Library/Python/3.9/lib/python/site-packages/pandas/io/formats/format.py - line number: 915 - function name: in DataFrameFormatter._get_formatter(self, i) - code line: --> 915 return self.formatters.get(i, None) - line of code that was actually executed - Common Python Error Types: - TypeError: wrong data type used - ValueError: correct type but inappropriate value - IndexError: List/Array index out of range - KeyError: missing key in dictionary https://nostarch.com/python-crash-course-3rd-edition https://stackoverflow.com/questions/5813614/what-is-difference-between-errors-and-exceptions