Merken

Solution oriented error handling

Zitierlink des Filmsegments
Embed Code

Automatisierte Medienanalyse

Beta
Erkannte Entitäten
Sprachtranskript
thank you and you alone will come to my talk about solution-oriented error handling which is a set of simple set of guidelines tools
used the mechanisms of Python for an efficient way of error handling it doesn't work with the standard libraries and you don't need any extensions has use a small amount of dedicated error-handling code and most difficult can focus on producing the results and producing the stuff you users actually wanted the it use helpful error
messages that are easy to derive from the code and consequently simplify support in a way that users might be able to deal with more terrorist himself father opening tickets or or even if you get a ticket and the error messages in the tickets to get more information than information to fix it yourself and support the user what I'm talking
about now is I give a short introduction about errors in general then give an overview of errors in Python holders Python represent errors with exception handling hardest 17 up resources of terrorists that I'm going to focus on the principles of solution oriented error handling with a dedicated sections on error messages and error hierarchies or exception hierarchies and I'm
summarizing the whole thing at the end of a couple of recommendations and guidelines you can apply to your code so about
errors wildlife areas errors in the context I'm talking about conditions that prevent the program from producing the desired result so readily errors come
from that was used both
include that's bad yeah they
don't have any currently on a proper marriage you know that was just an error handling so I don't know what's wrong I don't know what to report so I can do is we started conclusion so it is it could recover from the error they had lost control into to your choose and inefficient and you know we
have a program that supposed to produce the results what is the
program come from the roma come from you to develop you write a program you call but you don't usually don't code for yourselves you coded for user who wants to result that's why comes to you says I want something useful please make it from the final user usually doesn't only want to program he wants to provide input and the program should create a result depending on its input additionally to get you need an environment for the program to run in and environment sometimes provided by users sometimes it's provided by dedicated people usually call operations so that's the whole thing we do basically so how can
errors creep into the whole concept of all the users can
provide broken input you might use invalidate words that might will use when he is out of range operators can provide insufficient environment where excess right missing value can connect network is food and develop can write a program that is broken in the sense that it misses corner cases this is incorrect results or is it just seeing that has insufficient error handling like leader of so the there is a fixed well
in case of LibreOffice if this ever gets fixed someone will sit down and write better program so it's pretty much the same input data and environment errors the fixed
but people they have more memory and it's what a changing potatoes so that their relative after that program can continue and finally choose the desired itself for people to excellent feature fix terrorist they need information and the the program provides information which LibreOffice actually begin to develop rights the program in a way
so that it provides this information and is what this talk is about solution-oriented arrangement is wave to making it easier for you to provide information to fix the
errors became errors in do widely use way to
represent terrorism exceptions so you can do funny values you can do global variables but essentially and consistently the standard library users exceptions to represent Paris
and encourage you to do the same the major benefit of exceptions this but they cannot be ignored accidentally you don't have to check is done once an exception is raised it just reverses of the calling state until some routine decides to deal with their to the Python programme cannot simply continue after an error has already appeared in C. this is pretty simple so how do you get there
while use and the error condition and if the condition is true you know when have an error and then you just raise an exception is a true example of a the type of parenting and it's it's less than 0 or it is 0 the on exceptions tells me that they must be greater than 0 what can you want
an exception is raised like an analytic using the except clause in this case I try my routine passing and then you get an exception and if I print exception I gets the the error message on the screen in this case we
get the result at the hospital must be greater than 0 when I want to clean up after
necessarily mechanisms is a simple 1 of the 1st 1 in case of a fire and I try to open the file it works out to try to process the data read from the file and finally just clean up the closing the file interesting thing
about that finally close to 5 independent if there's an error or not it will also justified because is statement for that
there's little bit different syntax less cold and gives the same result In order for with statement to work you need the context manager of the class to use in this case the file object needs to provide context manager who gonna rush through this a bit I
can simply add context context mention flow using closing routine which is very useful in patent to in and by free because most of the standards of objects or half the context manager but in this case I can have the
following 2 results and when you want to write their own context manager in
then you have to look at basically to the standard routines to class is a very simple example z passed to copy a file the initial part just indicates the source file and the target file to admit there is a around part which runs the tasks and it simply corpus the bytes from 1 yeah and there is a kind of thing called close which closes to files as in the various because it doesn't do any of you I could use this delivery the radius of the try and finally to them because task run it and executed and gene of the resources of the if I want to do it the context manager and with class just have to add to routines Standard next and will always look like that's the context manager can do a lot of things but if you just want to use in this class there's nothing more to it as soon as you have a closed and initialize of helicase water resources and a close reading that gives all of them back that's
the context manager these 4 lines of code and once you have
these you can use the what's happening here the class of the calls the in functional that's the part we create the object wants you assignments to variables call-center function the science of the value of of the result of enter to the variables but once the whole with close and it calls the exit function that's basically what context managers to and I think it's a very simple way to not
bother much about giving back resources here's an example of the improved context manager can the initial variance
basically only allocated the resources and you can run in the case when you look at multiple resources that the initialize already breaks after indicating the source files but it cannot open the target file and you want to make sure to give effect to target for so you basically you know remember all resources initialized and non and make a close reading of its model only close to those of us that are not longer and the Indian all the checks for errors and if there is an error calls to close before him subgradient simple principle
and then there's another statement to the vector of neuron talked about rabies noses how many people know there is a statement by used it already OK How many people think they they know when to use as and when to use race it's already so you have a table of offered to know about them and about 10 per cent to think to know when to use it properly but what is this statement like but also detect
an error using as is again the the previous example with the rate is I can do the same with research by just specifying condition in this case it's not the error condition but condition for a correct hate must be greater than 0 0 and provide a message which is optional in this case there is a couple of differences
within a certain internally just raises an assertion to some extent it is comparable with radius however you can deactivate if you run from the command line with the minus 0 speech what digital but the events checking of assertions which might increase performance a little and my dreams inconsistencies checks 5 just call back search therefore must not have any side effects because otherwise the program starts to be living differently whether minus 0 specify model and the question now is when reuse racist and when you use search is something I'm going to talk about this later so in summary In the
case of Python's exception-handling is that you can't date arrows with race or a circle you can
deal with terrorists using trying to accept and you can clean using finally closing the context manager these are tools Python gives you when you install it everything of this is already the air so the interesting but it's not how the all this in a solution oriented way the principles of solution-oriented error handling
our that you focus on the solutions and that's what's wrong you have clear responsibilities between developers and users and operators you have helpful in
specific error messages and error conditions and error messages can be derived from the cold so it is a developer-centric approach but everybody wants abilities let's take a look at the graphics that we had
before the responsibility of the user and the operators each year to have to provide a sufficient complete and valid input for the program used to resolve the operators have to provide an environment where the program has everything he needs concerning access rights memory and so on and the development has the responsibility to write a program so that's something important to remember that all we can do is write a program that we cannot edit memory at the user side we
cannot add or change the world so that it works users to do that however we also have another responsibility if the program cannot produce results we have to provide helpful information to the user what we have to make a program to provide helpful information to the user so that they can fix any on site I can do it using a circle with a set a tool to detect and
by taking this internal programs detects errors before the program is delivered so it's as a tool for the local and if the insertion phase the developed by has to fix the errors by changing the code maybe has to cover new requirements and what not but the end of the day you will have to to change the cold modernization to go away so the target audience for the assertion communities to develop and assertions of the detector boxes the program assertions are very
useful tool to establish clear responsibilities between call calling routines you can particularly you use it to better parameter and point out invalid parameters so that's that something about variance of the lot this is called preconditions and such provide executable documentation so it's it's spelled bright assertions which actually check to parameters correct and write documentation nobody reads and that might get out of date assertions are executed every time the program runs so once this session gets all the data you have to to fix the on the other hand raised you can use to make errors in the data and environmental In things the use and operators can
solve so they can provide valid data from the input on can provide sufficient environment with enough memory disk space and connections that the connection the races something to point out conditions to develop cannot deal live at the time he writes
the program he has no influence and this conditions the target audience periodically uses and the operations so a couple of words converting error messages while you have a lot of usability guidelines books about it written by usability people but very often they're too vague for developers to actually turned into codes of their messages should people life sized constructive but to actually wouldn't and in practice you see that many error messages talk a lot of other things that are wrong another what should I do what's what's actually precisely wrong what can I do with my possibilities so sort solution-oriented approach to error messages is that describe the actual state and when you and the 1 that would have been expected describe the actions necessary to solve their own and describe the actions that led to an error to provide context material comes from so does to look for in terms of college so I was 1 slide but as
the in terms of culture generally called 2 detectors who looks like that if an action plan is not expected value than erase some error of the message itself must be expected so we already have these in my code is an example we already know interface is less and smaller than 0 arrays value error which is says they must be greater than 0 order
describe a solution flow already current alternate was great and 0 such from all this error message you user just has to do whatever is necessary to establish the expected conditions for that of course you have to understand the program and how to use it couple more examples for
such error messages date of birth must match register date for what the option intersection they are config file must be 1 of red green blue so describe
the action and the value that led to the when I raise an error I just specify whether you use in my American which means in my case at the value minus
0 but just added to the error message error messages status 0 but must be greater than it is minus 3 but must be greater than 0 when I get an error already from calling complicated to accept statement I don't know what the initial condition also I just have to rely on mission message however I can get the
context in which the error pure so I just described the action that would not be performed typically cannot process that can connect to almost a can write to the file I cannot prepare use the value of the form fields so I described the idea and in this research I have to use the terms the user knows so not my variable names which gives the same but something the user knows and then all the information in the error messages something the user should give to deal with provided has enough knowledge about software and how to use let's take a look at an example during the
resulting in this process something and gets variable and parameter and raises an exception if it is not in the Valley French is a routine that would
process pace of values it gets from file so basically it opens the file reads aligned converted to integer bounds checks for errors if everything goes wrong 5 of fingers right there is no exceptions if there is an exception it's right it's an error message Users can process data file and the following line and the line number and the actual error message it got In the value error and in summer and all of this in case of error would be cannot process data some text line 17 is minus free but must be greater than 0 and
basically you get all this for free from the cold you're really wrong so in summary pattern for error messages is can perform an action at a certain location something is sexual but must be expected and you should have all of this
available in your code but some
exception hierarchy and to make it easier for you exceptions but classes in
Python allow organized in a hierarchy which allows us to collect similar exceptions in groups and deal with them In the same way so we can use this to
assign responsibilities it's already pretty clear that developers should a fixed assertion In my experiences breach that uses an operator should think so as as point about there is a quite a large amount of exceptions where you can't really say saying who's responsible fix so it's your task to make this more specific in my experience I usually just defined the data because that's the
arrows about using what users can fix and when I that something about it but just raised their own exceptions raised by other value error index there error look up
are very often indicates that the data are such as sketched success and we raised in the state of the art in is an example of how to define a data there
are pleasing in Python other
convert value today there are I just catch the value of embraces the the area where the original message intact in Python free you can also a service sector is by using exception training this is an example for that
so use a solution-oriented exception hierarchy basically comes down to users fixed data error and West error and a developer fixes everything else
in particular solution couple of recommendations for acceptance rates when the use except you have to use that
all mostly of the main routine and bring the narrowness introduce something useful if every exception in graphical applications you should use it for every closed user operation form picture catalyst developers call it if the enclosed operation phase you can say this operation failed and you
have to establish this or that condition because most of us use except to convert of exceptions to there just to make it clear who's who's responsible and you can use except through convert errors into rallied states which is that the risk of principle but right works reasonably well this for example to provide default values for things that are simply not there so generally you hardly ever used except and when he was in a
tightly focused which means little work for the development but which also means that the error handling the core becomes very easy because most of the time you just enough if there's an error you don't care because you can't fix it the user to sets operators to fix it so you just clean up and it's a result was that eventually the color model
the calling routine smooth decides what to do with it but it's not your problem at the moment the nice thing is that you don't have to care about producing the result because the exception mechanism already stops the productive part of your code and the benefit of all this is that you have a clean focusing on producing itself and it doesn't seem to mean you with try except and what not when the detection area
well it's pretty easy if you use natural name in your call means the routines in the called have the same names as the things they're supposed to perform and functions have the name of the things that's supposed to return because then the error condition is planned it can don't the things it's supposed to perform as the name
suggests white cannot return result it's supposed to return that's an error condition and in that case use race why is a small template for common LAN application of that the
interesting part is the most
interesting part here you have the production code that should produce results if you can do it handles pay their own ways there are 2 and if there's anything else it just locks the exception including the spectra that's all there is if it's a simple command-line application there is not a single except statement in its this may be a couple of statements really that's never conditions but
other than that you don't have ball about and and it gives a lexical 0 or 1 depending on the choice of but in summary solution-oriented error handling is a
set of guidelines to efficiently use Python's exception-handling the core consideration who can fix the error users can fix errors during runtime if they are they
there as well as various developments can fix errors during the implementation if there are exceptions for insertions or other exceptions and you always clean up in case of own and you always clean up even if the result is produced with finally the with statement in context managers so error-handling COLT basically consists of the data in a couple of conditions that
indicate there's reason is that most of the time just delegates the exceptions and a few specific locations catch them except the patent for
helpful error messages can perform actions that location something is actually but must be expected which automatically describes the solutions to the OK it's
question thank you Thomas any questions about the 2 microphones but there was no do you know if there is a way to simulate you from our our from hasn't really high level to sort understand you is there were made to immediately you from errors in text from present we have to only by making a role there's no meaning when you can use the original spectra is neural exceptions but I think you have to go down and dirty metaprogramming particularly with that never the less of things I think Matt at time for questions and maybe get at 1 point round the most times and French
Menge
Code
Vorlesung/Konferenz
Fehlermeldung
Resultante
Kraftfahrzeugmechatroniker
Standardabweichung
Code
Programmbibliothek
Vorlesung/Konferenz
Information
Maßerweiterung
Message-Passing
Code
Computeranimation
Fehlermeldung
Message-Passing
Hierarchische Struktur
Vorlesung/Konferenz
Garbentheorie
Ausnahmebehandlung
Code
Computeranimation
Fehlermeldung
Resultante
Metropolitan area network
Flächeninhalt
Konditionszahl
Vorlesung/Konferenz
Softwareentwicklung
Extrempunkt
Kontextbezogenes System
Computeranimation
Fehlermeldung
Resultante
Gamecontroller
Vorlesung/Konferenz
Softwareentwicklung
Fehlermeldung
Resultante
Nichtlinearer Operator
Softwareentwickler
Softwareentwicklung
Programmierumgebung
Ein-Ausgabe
Nichtlinearer Operator
Dateiformat
Code
Computeranimation
Portscanner
Ein-Ausgabe
Mini-Disc
Programmierumgebung
Fehlermeldung
Resultante
Nichtlinearer Operator
Datennetz
Softwareentwicklung
Ein-Ausgabe
Information
Computeranimation
Portscanner
Spannweite <Stochastik>
Rechter Winkel
Vorlesung/Konferenz
Wort <Informatik>
Programmierumgebung
Fehlermeldung
Portscanner
Softwareentwickler
Rechter Winkel
Wellenlehre
Festspeicher
Vorlesung/Konferenz
Softwareentwicklung
Information
Information
Computeranimation
Selbstrepräsentation
Ausnahmebehandlung
Information
Widerspruchsfreiheit
Computeranimation
Portscanner
Variable
Softwaretest
Standardabweichung
Programmbibliothek
Vorlesung/Konferenz
Fehlermeldung
Standardabweichung
Programmiergerät
Konditionszahl
Datentyp
Vererbungshierarchie
Vorlesung/Konferenz
Ausnahmebehandlung
Information
Datenfluss
Computeranimation
Aggregatzustand
Fehlermeldung
Resultante
Code
Vorlesung/Konferenz
Ausnahmebehandlung
Message-Passing
Computeranimation
Fehlermeldung
Touchscreen
Kraftfahrzeugmechatroniker
Befehl <Informatik>
Mereologie
Vorlesung/Konferenz
Objektklasse
Elektronische Publikation
Computeranimation
Fehlermeldung
Resultante
Koroutine
Bit
Befehl <Informatik>
Subtraktion
Mereologie
Klasse <Mathematik>
Einfach zusammenhängender Raum
Abgeschlossene Menge
Befehl <Informatik>
Objektklasse
Kontextbezogenes System
Elektronische Publikation
ROM <Informatik>
Datenfluss
Service provider
Computeranimation
Objekt <Kategorie>
Datenmanagement
Ordnung <Mathematik>
Standardabweichung
Resultante
Radius
Datentyp
Wasserdampftafel
Klasse <Mathematik>
Turing-Test
Quellcode
Objektklasse
Elektronische Publikation
Kontextbezogenes System
Computeranimation
Task
Task
Datenmanagement
Funktion <Mathematik>
Koroutine
Mereologie
Implementierung
Lesen <Datenverarbeitung>
Standardabweichung
Resultante
Lineares Funktional
Elektronische Publikation
Singularität <Mathematik>
Klasse <Mathematik>
Abgeschlossene Menge
Systemaufruf
Kontextbezogenes System
Code
Computeranimation
Objekt <Kategorie>
System F
Variable
Datenmanagement
Mereologie
Vorlesung/Konferenz
Gerade
Soundverarbeitung
Quellcode
Kontextbezogenes System
Elektronische Publikation
Extrempunkt
Computeranimation
Metropolitan area network
Informationsmodellierung
Datenmanagement
Vorlesung/Konferenz
Varianz
Lesen <Datenverarbeitung>
Fehlermeldung
Normalvektor
Subtraktion
Befehl <Informatik>
Konditionszahl
Vorlesung/Konferenz
Vektorraum
Bitrate
Message-Passing
Computeranimation
Fehlermeldung
Tabelle <Informatik>
Soundverarbeitung
Radius
Kreisfläche
Singularität <Mathematik>
Soundverarbeitung
Softwareentwicklung
Sprachsynthese
Ereignishorizont
Computeranimation
Portscanner
Informationsmodellierung
Zahlzeichen
Zeitrichtung
Maßerweiterung
Widerspruchsfreiheit
Nichtlinearer Operator
Softwareentwickler
Message-Passing
Datenmanagement
Code
Endogene Variable
Vorlesung/Konferenz
Ausnahmebehandlung
Nichtlinearer Operator
Softwareentwickler
Kontextbezogenes System
Computeranimation
Umwandlungsenthalpie
Nichtlinearer Operator
Softwareentwicklung
Ein-Ausgabe
Computeranimation
Portscanner
Message-Passing
Rechter Winkel
Konditionszahl
Festspeicher
Endogene Variable
Vorlesung/Konferenz
Softwareentwickler
Programmierumgebung
Fehlermeldung
Resultante
Koroutine
Web Site
Einfügungsdämpfung
Softwareentwickler
Kreisfläche
Quader
Softwareentwicklung
Aggregatzustand
Code
Computeranimation
Code
Parametersystem
Endogene Variable
Vorlesung/Konferenz
Information
Phasenumwandlung
Fehlermeldung
Punkt
Schreiben <Datenverarbeitung>
Raum-Zeit
Service provider
Computeranimation
Service provider
Datennetz
Mini-Disc
Endogene Variable
Koroutine
Vorlesung/Konferenz
Softwareentwickler
Varianz
Einfach zusammenhängender Raum
Nichtlinearer Operator
Parametersystem
Softwareentwickler
Systemaufruf
Softwareentwicklung
Programmierumgebung
Ein-Ausgabe
Konditionszahl
Festspeicher
Parametersystem
Mini-Disc
Programmierumgebung
Fehlermeldung
Nichtlinearer Operator
Videospiel
Softwareentwickler
Maschinencode
Benutzerfreundlichkeit
Gruppenoperation
Softwareentwicklung
Aggregatzustand
Kontextbezogenes System
Term
Service provider
Computeranimation
Gruppenoperation
Message-Passing
Datennetz
Konditionszahl
Vorlesung/Konferenz
Wort <Informatik>
Softwareentwickler
Message-Passing
Aggregatzustand
Fehlermeldung
Gruppenoperation
Automatische Handlungsplanung
Softwareentwicklung
Aggregatzustand
Dateiformat
Term
Datenfluss
Code
Computeranimation
Konditionszahl
Vorlesung/Konferenz
Ordnung <Mathematik>
Message-Passing
Array <Informatik>
Schnittstelle
Fehlermeldung
Domain <Netzwerk>
Garbentheorie
Matching <Graphentheorie>
Gruppenoperation
Einfach zusammenhängender Raum
Green-Funktion
Vorlesung/Konferenz
Elektronische Publikation
Dateiformat
Computeranimation
Fehlermeldung
Befehl <Informatik>
Elektronische Publikation
Prozess <Physik>
Gruppenoperation
Einfach zusammenhängender Raum
Anfangswertproblem
Elektronische Publikation
Kontextbezogenes System
Term
Computeranimation
Gruppenoperation
Bildschirmmaske
Bildschirmmaske
Datenfeld
Software
Vorlesung/Konferenz
Information
Term
Message-Passing
Fehlermeldung
Koroutine
Parametersystem
Prozess <Physik>
Funktion <Mathematik>
Ganze Zahl
Zahlenbereich
Ausnahmebehandlung
Elektronische Publikation
Gerade
Computeranimation
Fehlermeldung
Gebundener Zustand
Mustersprache
Message-Passing
Klasse <Mathematik>
Mustersprache
Gruppenoperation
Hierarchische Struktur
Vorlesung/Konferenz
Ausnahmebehandlung
URL
Code
Computeranimation
Fehlermeldung
Umwandlungsenthalpie
Nichtlinearer Operator
Softwareentwickler
Punkt
Gruppenkeim
Hierarchische Struktur
Ausnahmebehandlung
Ähnlichkeitsgeometrie
Computeranimation
Task
Metropolitan area network
Zustandsdichte
Endogene Variable
Vorlesung/Konferenz
Softwareentwickler
Portscanner
Puls <Technik>
Analog-Digital-Umsetzer
Automatische Indexierung
Code
Singularität <Mathematik>
Zeitrichtung
Vorlesung/Konferenz
Ausnahmebehandlung
Computeranimation
Aggregatzustand
Fehlermeldung
Portscanner
Message-Passing
Dienst <Informatik>
Umsetzung <Informatik>
Wellenpaket
Flächeninhalt
Singularität <Mathematik>
Ausnahmebehandlung
Objektklasse
Message-Passing
Computeranimation
Gruppenoperation
Teilmenge
Softwareentwickler
Diskrete-Elemente-Methode
Hierarchische Struktur
Vorlesung/Konferenz
Ausnahmebehandlung
Aggregatzustand
Bitrate
Softwareentwickler
Computeranimation
Fehlermeldung
Nichtlinearer Operator
Singularität <Mathematik>
Mathematisierung
Abgeschlossene Menge
Ausnahmebehandlung
Kartesische Koordinaten
Aggregatzustand
Service provider
Computeranimation
Portscanner
Mustersprache
Metropolitan area network
Bildschirmmaske
Rechter Winkel
Konditionszahl
Endogene Variable
Vorlesung/Konferenz
Softwareentwickler
Default
Phasenumwandlung
Aggregatzustand
Fehlermeldung
Resultante
Nichtlinearer Operator
Softwareentwickler
Mereologie
Momentenproblem
Singularität <Mathematik>
Ausnahmebehandlung
Code
Computeranimation
Informationsmodellierung
Menge
Flächeninhalt
Code
Mereologie
Vorlesung/Konferenz
Speicherabzug
Kantenfärbung
Softwareentwickler
Fehlermeldung
Resultante
Lineares Funktional
Koroutine
Template
Natürliche Zahl
Systemaufruf
Kartesische Koordinaten
Computeranimation
Gruppenoperation
Funktion <Mathematik>
Code
Konditionszahl
Koroutine
Vorlesung/Konferenz
Lokales Netz
Fehlermeldung
Resultante
Data Encryption Standard
Befehl <Informatik>
Universal product code
Logarithmus
Singularität <Mathematik>
Kartesische Koordinaten
Ausnahmebehandlung
Menge
Computeranimation
Metropolitan area network
Diskrete-Elemente-Methode
Schnelltaste
Code
Mereologie
Softwareentwickler
Singularität <Mathematik>
Rechenzeit
Turing-Test
Ausnahmebehandlung
Programmierumgebung
Menge
Computeranimation
Portscanner
Menge
Speicherabzug
Vorlesung/Konferenz
Speicherabzug
Auswahlaxiom
Fehlermeldung
Implementierung
Resultante
Einfügungsdämpfung
Befehl <Informatik>
Implementierung
Ausnahmebehandlung
Programmierumgebung
Kontextbezogenes System
Arbeitsplatzcomputer
Computeranimation
Mustersprache
Message-Passing
Datenmanagement
Code
Konditionszahl
Vorlesung/Konferenz
URL
Softwareentwickler
Fehlermeldung
Arithmetisches Mittel
Message-Passing
Punkt
Gruppenoperation
Vorlesung/Konferenz
Ausnahmebehandlung
Unrundheit
URL
Metaprogrammierung
Hilfesystem
Übergang
Fehlermeldung
Code
Computeranimation

Metadaten

Formale Metadaten

Titel Solution oriented error handling
Serientitel EuroPython 2014
Teil 11
Anzahl der Teile 120
Autor Aglassinger, Thomas
Lizenz CC-Namensnennung 3.0 Unported:
Sie dürfen das Werk bzw. den Inhalt zu jedem legalen Zweck nutzen, verändern und in unveränderter oder veränderter Form vervielfältigen, verbreiten und öffentlich zugänglich machen, sofern Sie den Namen des Autors/Rechteinhabers in der von ihm festgelegten Weise nennen.
DOI 10.5446/20039
Herausgeber EuroPython
Erscheinungsjahr 2014
Sprache Englisch
Produktionsort Berlin

Inhaltliche Metadaten

Fachgebiet Informatik
Abstract Thomas Aglassinger - Solution oriented error handling 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`?
Schlagwörter EuroPython Conference
EP 2014
EuroPython 2014

Zugehöriges Material

Ähnliche Filme

Loading...