Skip to content

Commit

Permalink
Merge pull request #562 from HubSpot/fix/projects/poll-status-errors
Browse files Browse the repository at this point in the history
Prevent spinnies error on upload if buildPolling fails
  • Loading branch information
anthmatic authored Sep 29, 2021
2 parents 04215c1 + a57bded commit eec3c7a
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions packages/cli/commands/project/upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,22 @@ const uploadProjectFiles = async (accountId, projectName, filePath) => {
)}`,
});

let buildId;

try {
const upload = await uploadProject(accountId, projectName, filePath);

buildId = upload.buildId;

spinnies.succeed('upload', {
text: `Uploaded ${chalk.bold(projectName)} project files to ${chalk.bold(
accountId
)}`,
});

logger.debug(
`Project "${projectName}" uploaded and build #${upload.buildId} created`
`Project "${projectName}" uploaded and build #${buildId} created`
);
await pollBuildStatus(accountId, projectName, upload.buildId);
} catch (err) {
if (err.statusCode === 404) {
return logger.error(
Expand All @@ -92,6 +95,12 @@ const uploadProjectFiles = async (accountId, projectName, filePath) => {
})
);
}

try {
await pollBuildStatus(accountId, projectName, buildId);
} catch (err) {
logger.log(err);
}
};

exports.handler = async options => {
Expand Down

0 comments on commit eec3c7a

Please sign in to comment.