Quantcast
Channel: EPPlus Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 2262

Created Unassigned: Rethrowing exceptions [14987]

$
0
0
Sometimes, tracking down exceptions occurring in EPPlus can be more difficult than necessary, due to some *catch* blocks throwing catched exceptions again,instead of rethrowing them.
The difference in code is minimal, but the outcome can be radically different.
```
catch (Exception ex)
{
throw (ex); // Lose the exception's original stack frame
// Now the exception appears to have originated on the previous line,
// which is misleading and unnecessarily complicates debugging
}
```
Code like the above (without the comments, that is) appears in at least 4 places in EPPlus. It's probably better to change it to:
```
catch (Exception ex)
{
throw; // Preserve the exception's stack frame
}
```


Viewing all articles
Browse latest Browse all 2262

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>