Skip to content

Commit 8d61f77

Browse files
author
Ives van Hoorne
committed
Handle unknown errors with ZEIT
1 parent d59c197 commit 8d61f77

File tree

1 file changed

+20
-7
lines changed
  • src/app/store/entities/sandboxes/actions

1 file changed

+20
-7
lines changed

src/app/store/entities/sandboxes/actions/index.js

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -346,13 +346,26 @@ export default {
346346

347347
const user = currentUserSelector(getState());
348348
const token = user.integrations.zeit.token;
349-
const res = await fetch('https://api.zeit.co/now/deployments', {
350-
method: 'POST',
351-
body: JSON.stringify(apiData),
352-
headers: {
353-
Authorization: `bearer ${token}`,
354-
},
355-
});
349+
350+
let res;
351+
try {
352+
res = await fetch('https://api.zeit.co/now/deployments', {
353+
method: 'POST',
354+
body: JSON.stringify(apiData),
355+
headers: {
356+
Authorization: `bearer ${token}`,
357+
},
358+
});
359+
} catch (e) {
360+
dispatch(
361+
notificationActions.addNotification(
362+
'An unknown error occured when connecting to ZEIT',
363+
'error'
364+
)
365+
);
366+
367+
throw e;
368+
}
356369

357370
const data = await res.json();
358371

0 commit comments

Comments
 (0)