Skip to content

Commit c4af342

Browse files
committed
Improve error reporting
Fixes #84
1 parent 64eaaca commit c4af342

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

cli.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,13 @@ async function init() {
186186
throw error;
187187
}
188188

189-
await execa('/usr/bin/codesign', ['--sign', identity, dmgPath]);
189+
try {
190+
await execa('/usr/bin/codesign', ['--sign', identity, dmgPath]);
191+
} catch (error) {
192+
ora.fail(`Code signing failed. The DMG is fine, just not code signed.\n${error.stderr?.trim() ?? error}`);
193+
process.exit(2);
194+
}
195+
190196
const {stderr} = await execa('/usr/bin/codesign', [dmgPath, '--display', '--verbose=2']);
191197

192198
const match = /^Authority=(.*)$/m.exec(stderr);
@@ -198,7 +204,7 @@ async function init() {
198204
ora.info(`Code signing identity: ${match[1]}`).start();
199205
ora.succeed(`Created “${dmgFilename}”`);
200206
} catch (error) {
201-
ora.fail(`Code signing failed. The DMG is fine, just not code signed.\n${Object.prototype.hasOwnProperty.call(error, 'stderr') ? error.stderr.trim() : error}`);
207+
ora.fail(`${error.stderr?.trim() ?? error}`);
202208
process.exit(2);
203209
}
204210
});

0 commit comments

Comments
 (0)