added structured error messages to rest api responses