[BISERVER-9167] Add better error handling
Merge pull request #558 from bytekast/BISERVER-9167

[BISERVER-9167] Add better error handling