Skip to content

Commit

Permalink
fix: catch upload timeouts and return a better error message
Browse files Browse the repository at this point in the history
  • Loading branch information
erunion committed Jul 9, 2021
1 parent db0fcfd commit 773692b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/cmds/openapi.js
Original file line number Diff line number Diff line change
Expand Up @@ -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!'));
}
}
Expand Down

0 comments on commit 773692b

Please sign in to comment.