From d469548d1424e0e7b7d55853fc54048208510f72 Mon Sep 17 00:00:00 2001 From: Stefano Verna Date: Fri, 29 May 2020 14:29:02 +0200 Subject: [PATCH] Pass correct ApiException in case of asyncronous jobs --- package.json | 2 +- src/utils/generateClient.js | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index efb2e382..3b2964a6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "datocms-client", - "version": "3.0.24", + "version": "3.0.25", "description": "DatoCMS API client and CLI tool", "browser": "dist/client.js", "main": "lib/index.js", diff --git a/src/utils/generateClient.js b/src/utils/generateClient.js index c8146c3d..5a904152 100644 --- a/src/utils/generateClient.js +++ b/src/utils/generateClient.js @@ -164,7 +164,10 @@ export default function generateClient(subdomain, cache, extraMethods = {}) { jobResult.attributes.status >= 300 ) { throw new ApiException( - jobResult, + { + status: jobResult.attributes.status, + statusText: jobResult.attributes.statusText, + }, jobResult.attributes.payload, ); }