Skip to Content.
Sympa Menu

grouper-users - RE: [grouper-users] GrouperShell and exception handling

Subject: Grouper Users - Open Discussion List

List archive

RE: [grouper-users] GrouperShell and exception handling


Chronological Thread 
  • From: Chris Hyzer <>
  • To: Scott Koranda <>, grouper-users <>
  • Subject: RE: [grouper-users] GrouperShell and exception handling
  • Date: Tue, 22 Nov 2011 04:28:42 +0000
  • Accept-language: en-US

We are using 2.0b4 2005-05-23, which might be the latest, but not quite :)

Maybe exception handling for flow control isn't ideal, you could check to see
if it exists with an if statement :)

Im afraid there could be an exception for a different reason, or the
exception is correct but wrapped in a Runtime or another type of exception...
i.e. I don't really think when we develop the API we are too worried about
exactly what type of exceptions are thrown in certain circumstances...

That said, I think a lot of the built in gsh commands catch the exceptions,
print errors, and don't rethrow. If you use the API you will be able to what
you want (if you still want to go down that route)

gsh 7% new
GroupSave(grouperSession).assignName("test:testGroup").assignSaveMode(SaveMode.INSERT).save();
// Error: unable to evaluate command: Sourced file: inline evaluation of:
``new
GroupSave(grouperSession).assignName("test:testGroup").assignSaveMode(SaveMo
. . . '' : Method Invocation save
// See error log for full stacktrace
// caused by:
edu.internet2.middleware.grouper.exception.GroupAddAlreadyExistsException:
// group already exists with name: 'test:testGroup', stem name: test, group
extension: testGroup, group dExtension: testGroup, uuid: null, typeOfGroup:
null,
Problem in HibernateSession: HibernateSession: isNew: false, isReadonly:
false, grouperTransactionType: READ_WRITE_NEW,
Problem in HibernateSession: HibernateSession: isNew: true, isReadonly:
false, grouperTransactionType: READ_WRITE_NEW
gsh 8% try{ new
GroupSave(grouperSession).assignName("test:testGroup").assignSaveMode(SaveMode.INSERT).save();}
catch (e) { System.out.println("oh well"); }
oh well
gsh 9%

Thanks,
Chris

-----Original Message-----
From:


[mailto:]
On Behalf Of Scott Koranda
Sent: Monday, November 21, 2011 9:43 PM
To: grouper-users
Subject: [grouper-users] GrouperShell and exception handling

Hi,

I was looking at the BeanShell documentation at

http://www.beanshell.org/manual/syntax.html#Exception_Handling

and hoping to be able to use try/catch blocks in GrouperShell
(gsh), but it seems I cannot catch any exceptions.

For example if I try to add a group that already exists I
would like to catch the throwable and take a different
action.

Is that possible in GrouperShell?

Thanks,

Scott



Archive powered by MHonArc 2.6.16.

Top of Page