A-M baby
This commit is contained in:
parent
764da6cbbb
commit
db842d013d
19005 changed files with 197040 additions and 7 deletions
|
|
@ -0,0 +1,13 @@
|
|||
# Let's call our custom error "StupidError"; it inherits from the Exception class
|
||||
|
||||
class StupidError(Exception): pass
|
||||
|
||||
# Try it out.
|
||||
try:
|
||||
raise StupidError("Segfault") # here, we manually 'raise' the error within the try block
|
||||
except StupidError, details: # 'details' is the StupidError object we create in the try block.
|
||||
print 'Something stupid occurred:', details # so we access the value we had stored for it...
|
||||
|
||||
|
||||
# Output :
|
||||
# Something stupid occurred: Segfault
|
||||
Loading…
Add table
Add a link
Reference in a new issue