Thomas Aglassinger - Solution oriented error handling смотреть онлайн
Thomas Aglassinger - Solution oriented error handling
[EuroPython 2014]
[22 July 2014]
This talk shows how to use Python's built in error handling mechanisms to keep the productive code clean, derive error messages helpful for the user directly from the code and release ressources properly.
-----
Traditionally error handling is regarded an annoyance by developers because it removes the focus from the already difficult enough productive parts of the code to parts that ideally will never be called. And even if, end users seem to be ignore the error messages and just click "Ok" or call the help desk.
Solution oriented error handling uses Python's existing try/catch/finally idiom, with statement, assert statement and exception hierarchy in a way that keeps the code clean and easy to maintain. It gives a clear distinction between errors that can be solved by the end user, the system administrator and the developer. Naming conventions and a simple set of coding guidelines ensure that helpful error messages can be easily derived from the code.
Most code examples work with Python 2.6+ and Python 3.x, on a few occasions minor differences are pointed out.
Topics covered are:
1. Introduction to error handling in Python
- What are errors?
- How to represent errors in Python
- Detecting errors
- Delegating errors to the caller
- clean resource management
2. Principles of solution oriented error handling
- responsibilities between user, admin and developer
- when to use raise or assert
3. Error messages
- What are "good" error messages
- How to derive error messages from the source code
- Adding context to the error
- How to report errors to the user
4. Solution oriented usage of Python's exception hierarchy
- admins fix `EnvironmentError`
- users fix `DataError`
- representing `DataError`
- converting exceptions to `DataError`
- developers fix everything else
- special Python exceptions not representing errors
5. Template for a solution oriented command line application
6. Best practices for `raise` and `except`
- When to use `raise`?
- When to use `except`?
This talk is a translation of a German [talk](https://github.com/roskakori/talks/tree/master/pygraz/errorhandling) given at the PyGRAZ user group and in a (slightly depythonized variant) the Grazer Linux Tag 2013 ([slides and video](http://glt13-programm.linuxtage.at/events/198.de.html)).
Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Thomas Aglassinger - Solution oriented error handling» бесплатно и без регистрации, вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.
Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.
Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!
Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.