@pega/dx-component-builder-sdk 8.23.17 → 8.23.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/tasks/publish-all/helper.js +24 -30
package/package.json
CHANGED
|
@@ -243,42 +243,36 @@ export const publishComponentToServer = async (data, doFetch = true) => {
|
|
|
243
243
|
refresh_token: refreshToken
|
|
244
244
|
} = JSON.parse(OauthData);
|
|
245
245
|
let status = 500;
|
|
246
|
-
fetch(url, {
|
|
246
|
+
const response = await fetch(url, {
|
|
247
247
|
method: 'POST',
|
|
248
248
|
agent: getHttpsAgent(defaultPegaConfig),
|
|
249
249
|
headers: {
|
|
250
250
|
Authorization: `${tokenType} ${accessToken}`
|
|
251
251
|
},
|
|
252
252
|
body: JSON.stringify(apiBody)
|
|
253
|
-
})
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
}
|
|
277
|
-
else {
|
|
278
|
-
throw new Error(`${respData.message}`);
|
|
279
|
-
}
|
|
280
|
-
})
|
|
281
|
-
.catch(e => Promise.reject(`${chalk.bold.red(e)}`));
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
if (!response.ok) {
|
|
256
|
+
if (response.status === 408) {
|
|
257
|
+
throw new Error(
|
|
258
|
+
'Time out'
|
|
259
|
+
);
|
|
260
|
+
}
|
|
261
|
+
if (response.status === 401) {
|
|
262
|
+
throw new Error(
|
|
263
|
+
'Error occurred in authentication. Please regenerate using authenticate'
|
|
264
|
+
);
|
|
265
|
+
}
|
|
266
|
+
if (response.status === 403) {
|
|
267
|
+
throw new Error(
|
|
268
|
+
'Error forbidden: User does not have privileges to Publish.'
|
|
269
|
+
);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
const data = await response.json();
|
|
275
|
+
|
|
282
276
|
} else {
|
|
283
277
|
throw new Error(`Error occurred in authentication. Please regenerate using authenticate`);
|
|
284
278
|
}
|