Breaking the build is evil was: Re: [jbosstools-dev] throw/catch Exception is evil

Max Rydahl Andersen max.andersen at redhat.com
Wed Jul 18 06:14:39 EDT 2007


yup I suck. I broke the build by not committing a working 
xmlserializationhelper.....I take the blame - fixing it..

/max


Max Rydahl Andersen wrote:
> Hi,
> 
> Just being trying to hunt down some issues I bumped into within the seam 
> builder and views and I spent a looong time figuring out what was going on.
> 
> And eventually it boiled down to the over usage of just doing throw and 
> catch Exception instead of actually trying to only handle the exceptions 
> the code actually can handle.
> 
> So *please* stop doing things like
> 
> try {
>    sp.store();
> } catch (Exception e) {
>     SeamCorePlugin.getPluginLog().logError("Error storing build results 
> for " + sp.getProject().getName());
>  }
> 
> that code should be:
> 
> try {
>     sp.store();
>    } catch (IOException e) {
>     SeamCorePlugin.getPluginLog().logError("Error storing build results 
> for " + sp.getProject().getName(), e);
>         }
> 
> So what's the difference:
> 
> Catching Exception also catches RuntimeExceptions like 
> NullPointerException meaning it swallows bugs! QA has zero change of 
> catching such bugs if we hide it from them (plus all the exception 
> handling code becomes useless when just using Exception).
> 
> Thus I changed the store() operation to only throw what it actually 
> throws (IOException) plus actually logging the exception to be able to 
> figure out why the IOException occurred.
> 
> Thanks ;)
> 
> /max
> _______________________________________________
> jbosstools-dev mailing list
> jbosstools-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/jbosstools-dev




More information about the jbosstools-dev mailing list