Skip to content

Missing exit codes on "fetch" scripts #175

Description

@dev-davva

Description

The scripts utilising fetch are currently swallowing exceptions (deploy.js, deploy-prod.js, create-addon.js, etc..)

When calling the script from a terminal, it will always report back as successful, even if it has failed.
This causes problems with CI/CD pipelines, that rely on exit codes to present results and handle control flow.

Expected behaviour

try {
  const response = await fetch(url, {
...
  });

  handleResponse({ response, operation: 'Upload' });
} catch (err) {
  console.log(`${chalk.red('Upload failed, status code:')} ${err}`);
  // exit with error code here, or maybe re-throw exception to handle it further up the call chain?
}

Current behaviour

try {
  const response = await fetch(url, {
...
  });

  handleResponse({ response, operation: 'Upload' });
} catch (err) {
  console.log(`${chalk.red('Upload failed, status code:')} ${err}`);
  // exception is being swallowed here
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions