0

I need to throw exception from Grails service. But :

  1. The exception has to be "checked" so that Hibernate would not rollback upon throwing that exception. But looks like the base exception class in Grails ( "GrailsException" ) is unchecked (extented from RuntimeException). Is there any checked exception exists in Grails that I can extend for my purpose? If not how can I create a checked exception class in Grails?

  2. I am not very clear about when an exception can be called "checked" or "unchecked"? May be, more specifically, my question is what is a checked exception and what are the characteristics of it?

I can provide code example if more clarification on my question is required. I tried:

class MyException extends GrailsException { 
}

and it's rolling back the transaction on this exception

Thanks in advance

Burt Beckwith
  • 75,342
  • 5
  • 143
  • 156
VictorGram
  • 2,521
  • 7
  • 48
  • 82

1 Answers1

0

There's no requirement that you subclass any Grails exception - extend java.lang.Exception or any other checked exception as your base class.

Burt Beckwith
  • 75,342
  • 5
  • 143
  • 156