##// END OF EJS Templates
pspersistence report UsageError's instead of crashing on 'error'
Ville M. Vainio -
Show More
@@ -8,6 +8,7 b' $Id: iplib.py 1107 2006-01-30 19:02:20Z vivainio $'
8 """
8 """
9
9
10 import IPython.ipapi
10 import IPython.ipapi
11 from IPython.ipapi import UsageError
11 ip = IPython.ipapi.get()
12 ip = IPython.ipapi.get()
12
13
13 import pickleshare
14 import pickleshare
@@ -96,12 +97,12 b" def magic_store(self, parameter_s=''):"
96 try:
97 try:
97 todel = args[0]
98 todel = args[0]
98 except IndexError:
99 except IndexError:
99 error('You must provide the variable to forget')
100 raise UsageError('You must provide the variable to forget')
100 else:
101 else:
101 try:
102 try:
102 del db['autorestore/' + todel]
103 del db['autorestore/' + todel]
103 except:
104 except:
104 error("Can't delete variable '%s'" % todel)
105 raise UsageError("Can't delete variable '%s'" % todel)
105 # reset
106 # reset
106 elif opts.has_key('z'):
107 elif opts.has_key('z'):
107 for k in db.keys('autorestore/*'):
108 for k in db.keys('autorestore/*'):
@@ -165,7 +166,7 b" def magic_store(self, parameter_s=''):"
165 print "Alias stored:", args[0], self.alias_table[ args[0] ]
166 print "Alias stored:", args[0], self.alias_table[ args[0] ]
166 return
167 return
167 else:
168 else:
168 print "Error: unknown variable '%s'" % args[0]
169 raise UsageError("Unknown variable '%s'" % args[0])
169
170
170 else:
171 else:
171 if isinstance(inspect.getmodule(obj), FakeModule):
172 if isinstance(inspect.getmodule(obj), FakeModule):
General Comments 0
You need to be logged in to leave comments. Login now