HUE-1214 improve error handling