Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't swallow exceptions -- throw them up instead #17

Merged

Conversation

stellingsimon
Copy link
Contributor

Exceptions, and in particular IOException in networking code, should not be swallowed but thrown up to the caller, such that an appropriate error message can be generated for the end user. The client is still free to wrap all ical4j-Methods in a catch-all try-catch.

I made a fairly mechanic change to all the catch clauses:

  • replace e.printStackTrace() with throw new RuntimeException(..., e) for all checked exception's catch clauses.
  • remove catch clauses for NullPointerException in AbstractDavObjectCollection::getProperty(DavPropertyName propertyName, Class<P> type)
  • throw UnsupportedOperationException(...) in obviously unimplemented methods
  • No method signatures were changed

…nd throw UnsupportedOperationExceptions in unimplemented methods'
@codecov
Copy link

codecov bot commented Nov 17, 2017

Codecov Report

Merging #17 into develop will increase coverage by 0.14%.
The diff coverage is 0%.

Impacted file tree graph

@@             Coverage Diff              @@
##             develop     #17      +/-   ##
============================================
+ Coverage       1.74%   1.88%   +0.14%     
  Complexity         5       5              
============================================
  Files             44      44              
  Lines           2008    1852     -156     
  Branches         256     255       -1     
============================================
  Hits              35      35              
+ Misses          1973    1817     -156
Impacted Files Coverage Δ Complexity Δ
...una/ical4j/connector/FailedOperationException.java 0% <ø> (ø) 0 <0> (ø) ⬇️
...net/fortuna/ical4j/connector/dav/CardDavStore.java 0% <0%> (ø) 0 <0> (ø) ⬇️
...l4j/connector/dav/AbstractDavObjectCollection.java 0% <0%> (ø) 0 <0> (ø) ⬇️
...ortuna/ical4j/connector/dav/CardDavCollection.java 0% <0%> (ø) 0 <0> (ø) ⬇️
...tuna/ical4j/connector/dav/CalDavCalendarStore.java 0.77% <0%> (+0.01%) 1 <0> (ø) ⬇️
...ical4j/connector/dav/CalDavCalendarCollection.java 0% <0%> (ø) 0 <0> (ø) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 52ebac9...1af922c. Read the comment docs.

@benfortuna benfortuna merged commit d10a03b into ical4j:develop Nov 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants