From 773692b53d653bda46c685c6f72c937467e07c36 Mon Sep 17 00:00:00 2001 From: Jon Ursenbach Date: Fri, 9 Jul 2021 10:41:10 -0700 Subject: [PATCH] fix: catch upload timeouts and return a better error message --- src/cmds/openapi.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/cmds/openapi.js b/src/cmds/openapi.js index 69c4824dc..a94d1e900 100644 --- a/src/cmds/openapi.js +++ b/src/cmds/openapi.js @@ -86,6 +86,14 @@ exports.run = async function (opts) { const parsedError = JSON.parse(err.error); return Promise.reject(new APIError(parsedError)); } catch (e) { + if (e.message.includes('Unexpected token < in JSON')) { + return Promise.reject( + new Error( + "We're sorry, your upload request timed out. Please try again or split your file up into smaller chunks." + ) + ); + } + return Promise.reject(new Error('There was an error uploading!')); } }