Always store the error message and better error queue handling (#3522)
This commit is contained in:
parent
8508f7e67a
commit
05647d52c0
|
|
@ -14,9 +14,6 @@ async function run(options) {
|
|||
process.exitCode = 1;
|
||||
try {
|
||||
const result = await sitespeed.run(options);
|
||||
if (result.errors.length > 0) {
|
||||
throw new Error('Errors while running:\n' + result.errors.join('\n'));
|
||||
}
|
||||
|
||||
if (options.storeResult) {
|
||||
if (options.storeResult != 'true') {
|
||||
|
|
@ -26,6 +23,10 @@ async function run(options) {
|
|||
}
|
||||
}
|
||||
|
||||
if (result.errors.length > 0) {
|
||||
throw new Error('Errors while running:\n' + result.errors.join('\n'));
|
||||
}
|
||||
|
||||
if ((options.open || options.o) && os.platform() === 'darwin') {
|
||||
execSync('open ' + result.localPath + '/index.html');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -125,10 +125,6 @@ class QueueHandler {
|
|||
// FIXME handle rejections (i.e. failures while processing messages) properly
|
||||
queue.processingEnded(obj => {
|
||||
const message = obj.item;
|
||||
// if we get a error message on the queue make sure we register that
|
||||
if (message.type === 'error' || message.type.endsWith('.error')) {
|
||||
this.errors.push(message.data);
|
||||
}
|
||||
const err = obj.err;
|
||||
if (err) {
|
||||
let rejectionMessage =
|
||||
|
|
@ -197,6 +193,11 @@ class QueueHandler {
|
|||
postMessage(message) {
|
||||
validateMessageFormat(message);
|
||||
|
||||
// if we get a error message on the queue make sure we register that
|
||||
if (message.type === 'error' || message.type.endsWith('.error')) {
|
||||
this.errors.push('' + message.data);
|
||||
}
|
||||
|
||||
// Don't return promise in loop - we don't want to wait for completion,
|
||||
// just post the message.
|
||||
for (let item of this.queues) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue