): Promise<ResponsePayload> {
let uuid: string;
return promiseWithTimeout(
- new Promise((resolve, reject) => {
+ new Promise<ResponsePayload>((resolve, reject) => {
uuid = crypto.randomUUID();
const msg = JSON.stringify([uuid, command, data]);
const response = JSON.parse(messageEvent.data) as ProtocolResponse;
if (Array.isArray(response) === false) {
- throw new Error(`Response not an array: ${JSON.stringify(response, null, 2)}`);
+ throw new Error(`Response not an array: ${JSON.stringify(response, undefined, 2)}`);
}
const [uuid, responsePayload] = response;
}
this.deleteResponseHandler(uuid);
} else {
- throw new Error(`Not a response to a request: ${JSON.stringify(response, null, 2)}`);
+ throw new Error(`Not a response to a request: ${JSON.stringify(response, undefined, 2)}`);
}
}
}