Improve error handling
Merge pull request #219 from jrouzierinverse/feature/webapi-better-error-handling

Improve error handling of web api