api.request: bugfix in error reporting