Skip to content

Commit

Permalink
Merge pull request #410 from PineappleIOnic/fix-delete-archive-on-fail
Browse files Browse the repository at this point in the history
Fix Archive not being deleted when the deploy request fails
  • Loading branch information
christyjacob4 authored Apr 1, 2022
2 parents 65e6433 + 93c3b87 commit d4a2643
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions templates/cli/lib/commands/command.js.twig
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,11 @@ const {{ service.name | caseLower }}{{ method.name | caseUcfirst }} = async ({ {
{% for key, header in method.headers %}
'{{ key }}': '{{ header }}',
{% endfor %}
}, payload{% if method.type == 'location' %}, 'arraybuffer'{% endif %});
}, payload{% if method.type == 'location' %}, 'arraybuffer'{% endif %}){% if method.packaging %}.catch(err => {
fs.unlinkSync(archivePath);
throw err
});{% endif %}

} else {
const streamFilePath = payload['{{ parameter.name }}'];
let id = undefined;
Expand Down Expand Up @@ -135,7 +139,11 @@ const {{ service.name | caseLower }}{{ method.name | caseUcfirst }} = async ({ {
});
payload['{{ parameter.name }}'] = stream;

response = await client.call('{{ method.method | caseLower }}', path, headers, payload{% if method.type == 'location' %}, 'arraybuffer'{% endif %});
response = await client.call('{{ method.method | caseLower }}', path, headers, payload{% if method.type == 'location' %}, 'arraybuffer'{% endif %}){% if method.packaging %}.catch(err => {
fs.unlinkSync(archivePath);
throw err
});{% endif %}


if (!id) {
id = response['$id'];
Expand Down

0 comments on commit d4a2643

Please sign in to comment.