Skip to content

Commit 961c346

Browse files
Only add catches on function packaging
1 parent 2a1551f commit 961c346

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

templates/cli/lib/commands/command.js.twig

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,10 @@ const {{ service.name | caseLower }}{{ method.name | caseUcfirst }} = async ({ {
100100
{% for key, header in method.headers %}
101101
'{{ key }}': '{{ header }}',
102102
{% endfor %}
103-
}, payload{% if method.type == 'location' %}, 'arraybuffer'{% endif %}).catch(err => {
103+
}, payload{% if method.type == 'location' %}, 'arraybuffer'{% endif %}){% if method.packaging %}.catch(err => {
104104
fs.unlinkSync(archivePath);
105105
throw err
106-
});
106+
});{% endif %}
107107
} else {
108108
const streamFilePath = payload['{{ parameter.name }}'];
109109
let id = undefined;
@@ -133,10 +133,10 @@ const {{ service.name | caseLower }}{{ method.name | caseUcfirst }} = async ({ {
133133
});
134134
payload['{{ parameter.name }}'] = stream;
135135

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

141141
if (!id) {
142142
id = response['$id'];

0 commit comments

Comments
 (0)