Changes between Version 15 and Version 16 of TracDev/Exceptions
- Timestamp:
- Feb 23, 2016, 9:37:13 PM (8 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
TracDev/Exceptions
v15 v16 1 [[PageOutline(2-3,Contents)]] 2 1 3 = Exceptions 2 4 5 In programming '''exceptions''' are conditions of the program that require special processing. Handling exceptions is important, because to the user the program should function as if it were in a normal state whereby any exceptions that are encountered are handled in the background. See also [wikipedia:Exception_handling]. 6 7 This page lists the most common exceptions in Trac core and database communication. 8 3 9 == Custom Trac Exceptions 10 4 11 Trac defines a set of custom exception types: 5 12 … … 61 68 But changing the existing hierarchy might be difficult without breaking backward compatibility. 62 69 63 == DB Exceptions 64 We can catch [pep:0249#exceptions Python DB API exceptions] in a DB-neutral way. (Since Trac 1.0, see #6348.) 70 == Database Exceptions 71 72 We can catch [pep:0249#exceptions Python DB API exceptions] in a database neutral way. (Since Trac 1.0, see #6348.) 65 73 {{{#!python 66 74 try: … … 70 78 ... 71 79 }}} 80 72 81 The above example catches `sqlite.IntegrityError`, `MySQLdb.IntegrityError` or `psycopg.IntegrityError`, 73 82 depending on the selected DatabaseBackend. 74 83 75 76 84 ---- 77 85 See [query:keywords~=exception tickets]