[Geoserver-devel] Catalog and exceptions

Hi,
I was looking into the Catalog API and only
now I noticed there is no exception throwing
whatsoever. So all issues are going to be
reported by runtime exceptions?
What should be the pattern to save a new
resource?

Cheers
Andrea

If you look at the implementation CatalogImpl IllegalARgumentExceptions are thrown when a problem occurs adding a store / resource / namespace / workspace / etc... We should probably add a throws declaration to the interface.

If you think a checked exception would be better we can go that route as well.

Andrea Aime wrote:

Hi,
I was looking into the Catalog API and only
now I noticed there is no exception throwing
whatsoever. So all issues are going to be
reported by runtime exceptions?
What should be the pattern to save a new
resource?

Cheers
Andrea

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

!DSPAM:4007,48651b48196581431913854!

--
Justin Deoliveira
The Open Planning Project
jdeolive@anonymised.com

Justin Deoliveira ha scritto:

If you look at the implementation CatalogImpl IllegalARgumentExceptions are thrown when a problem occurs adding a store / resource / namespace / workspace / etc... We should probably add a throws declaration to the interface.

If you think a checked exception would be better we can go that route as well.

Hum, it seems to me the "Java way" is to throw checked exceptions for
every problem that's not related to a programming error. Thought I have
seen doing otherwise for Hibernate and Spring remoting, where the
throws is there, the exception is custom, but it's a runtime subclass.
The reasoning was that those are unrecoverable exceptions so you
want to just let them go to the UI and build an error message for
the user (which is what I did in the past).

For consistency with Java and GeoTools ways of doing things I
have a preference for checked excetions, but I worked the other
way without shooting myself in the foot in the past too.

Cheers
Andrea

Ok, lets make them checked exceptions then. WE should probably do this sooner rather than later. The longer we wait the more code we are going to have to change to catch the exceptions.

Andrea Aime wrote:

Justin Deoliveira ha scritto:

If you look at the implementation CatalogImpl IllegalARgumentExceptions are thrown when a problem occurs adding a store / resource / namespace / workspace / etc... We should probably add a throws declaration to the interface.

If you think a checked exception would be better we can go that route as well.

Hum, it seems to me the "Java way" is to throw checked exceptions for
every problem that's not related to a programming error. Thought I have
seen doing otherwise for Hibernate and Spring remoting, where the
throws is there, the exception is custom, but it's a runtime subclass.
The reasoning was that those are unrecoverable exceptions so you
want to just let them go to the UI and build an error message for
the user (which is what I did in the past).

For consistency with Java and GeoTools ways of doing things I
have a preference for checked excetions, but I worked the other
way without shooting myself in the foot in the past too.

Cheers
Andrea

!DSPAM:4007,48651d89207671804284693!

--
Justin Deoliveira
The Open Planning Project
jdeolive@anonymised.com

Justin Deoliveira ha scritto:

Ok, lets make them checked exceptions then. WE should probably do this sooner rather than later. The longer we wait the more code we are going to have to change to catch the exceptions.

Ok. CatalogException extends Exception, and all methods that deal with
save/delete/... throw it? Who does it?
Cheers
Andrea

Ok. CatalogException extends Exception, and all methods that deal with
save/delete/... throw it?

+1

Who does it?
Not sure... i am 4 hours away from vacation :stuck_out_tongue:

Cheers
Andrea

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

!DSPAM:4007,486527a4229051096210785!

--
Justin Deoliveira
The Open Planning Project
jdeolive@anonymised.com

Justin Deoliveira ha scritto:

Ok. CatalogException extends Exception, and all methods that deal with
save/delete/... throw it?

+1

Who does it?
Not sure... i am 4 hours away from vacation :stuck_out_tongue:

Hmm... funny, I'm kind of reading "aaime does it" in those
"4 hours away from vacation" statement.
Ha ha, cool :slight_smile: Enjoy your vacation!

Ciao
Andrea