Re-raise the original error if error parsing fails

- re-raise the original error if error parsing fails
- DRY up error handling code