Returning HTTP status 400 in case of any error instead of 500