Improve error handling

Merged Wael Ramadan requested to merge improve_error_handling into master

Merge request reports