Skip to content

Commit

Permalink
chore: Improve error messages when timeouts happen (Also for #298)
Browse files Browse the repository at this point in the history
  • Loading branch information
TimothyJones committed Jun 21, 2021
1 parent 4c77ddb commit 261650d
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ export abstract class AbstractService extends events.EventEmitter {
this.__instance.stdout.on('data', catchPort);
}

this.__instance.stderr.on('data', data =>
this.__instance.stderr.on('data', (data) =>
logger.error(`Pact Binary Error: ${data}`)
);

Expand All @@ -193,7 +193,7 @@ export abstract class AbstractService extends events.EventEmitter {
.catch((err: Error) => {
if (err instanceof TimeoutError) {
throw new Error(
`Couldn't start Pact with PID: ${
`Timeout while waiting to start Pact with PID: ${
this.__instance ? this.__instance.pid : 'No Instance'
}`
);
Expand All @@ -213,7 +213,9 @@ export abstract class AbstractService extends events.EventEmitter {
)
.catch((err: Error) => {
if (err instanceof TimeoutError) {
throw new Error(`Couldn't stop Pact with PID '${pid}'`);
throw new Error(
`Timeout while waiting to stop Pact with PID '${pid}'`
);
}
throw err;
})
Expand Down Expand Up @@ -251,7 +253,7 @@ export abstract class AbstractService extends events.EventEmitter {
if (amount >= RETRY_AMOUNT) {
reject(
new Error(
'Pact startup failed; tried calling service 10 times with no result.'
`Pact startup failed; tried calling service ${RETRY_AMOUNT} times with no result.`
)
);
}
Expand Down Expand Up @@ -285,7 +287,7 @@ export abstract class AbstractService extends events.EventEmitter {
if (amount >= RETRY_AMOUNT) {
reject(
new Error(
'Pact stop failed; tried calling service 10 times with no result.'
`Pact stop failed; tried calling service ${RETRY_AMOUNT} times with no result.`
)
);
return;
Expand Down

0 comments on commit 261650d

Please sign in to comment.