@@ -43,13 +43,19 @@ def _configure(self, parser):
43
43
parser .add_limit_arguments ()
44
44
parser .add_style_argument ()
45
45
parser .add_login_arguments ()
46
+ self .add_error ("NO_QUIET" , 67 ,
47
+ "Can't ask for query with --quiet option" )
48
+ self .add_error ("NOT_ADMIN" , 53 ,
49
+ ("SecurityViolation: Current user is not an"
50
+ " admin and cannot use '--admin'" ))
51
+ self .add_error ("BAD_QUERY" , 52 , "Bad query: %s" )
46
52
47
53
def __call__ (self , args ):
48
54
if args .query :
49
55
self .hql (args )
50
56
else :
51
57
if self .ctx .isquiet :
52
- self .ctx . die ( 67 , "Can't ask for query with --quiet option " )
58
+ self .raise_error ( "NO_QUIET " )
53
59
while True :
54
60
args .query = self .ctx .input ("Enter query:" )
55
61
if not args .query :
@@ -246,13 +252,12 @@ def project(self, querySvc, queryStr, params, ice_map):
246
252
return rv
247
253
except omero .SecurityViolation , sv :
248
254
if "omero.group" in ice_map :
249
- self .ctx .die (53 , "SecurityViolation: Current user is not an"
250
- " admin and cannot use '--admin'" )
255
+ self .raise_error ("NOT_ADMIN" )
251
256
else :
252
257
self .ctx .die (54 , "SecurityViolation: %s" % sv )
253
258
except omero .QueryException , qe :
254
259
self .ctx .set ("last.hql.rv" , [])
255
- self .ctx . die ( 52 , "Bad query: %s" % qe .message )
260
+ self .raise_error ( "BAD_QUERY" , qe .message )
256
261
257
262
try :
258
263
register ("hql" , HqlControl , HELP )
0 commit comments