Win a copy of Rust Web Development this week in the Other Languages forum!

Radoslaw Zubek

Greenhorn
+ Follow
since Sep 23, 2008
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Radoslaw Zubek

I have problem with some way of encapsulating boilerplate code. To avoid writing some part of code for http requests and responses each time, I decided to encapsulate it in one method. This method gets only query string and listener for response.



My problem is, that I have to throw a various exceptions depends on 'status' variable and this exceptions are thrown through 'BaseException'.



My question is how to avoid this ugly code for casting exceptions and encapsulate some boilerplate code.