Switching setVariable to a query and fixing error hangling in query mechanism
This commit is contained in:
parent
c30de8c6db
commit
bf17ad4567
6 changed files with 49 additions and 43 deletions
|
@ -192,7 +192,18 @@ window.addEventListener(
|
|||
|
||||
console.debug(payload);
|
||||
|
||||
if (isIframeAnswerEvent(payload)) {
|
||||
if (isIframeErrorAnswerEvent(payload)) {
|
||||
const queryId = payload.id;
|
||||
const payloadError = payload.error;
|
||||
|
||||
const resolver = answerPromises.get(queryId);
|
||||
if (resolver === undefined) {
|
||||
throw new Error('In Iframe API, got an error answer for a question that we have no track of.');
|
||||
}
|
||||
resolver.reject(new Error(payloadError));
|
||||
|
||||
answerPromises.delete(queryId);
|
||||
} else if (isIframeAnswerEvent(payload)) {
|
||||
const queryId = payload.id;
|
||||
const payloadData = payload.data;
|
||||
|
||||
|
@ -202,17 +213,6 @@ window.addEventListener(
|
|||
}
|
||||
resolver.resolve(payloadData);
|
||||
|
||||
answerPromises.delete(queryId);
|
||||
} else if (isIframeErrorAnswerEvent(payload)) {
|
||||
const queryId = payload.id;
|
||||
const payloadError = payload.error;
|
||||
|
||||
const resolver = answerPromises.get(queryId);
|
||||
if (resolver === undefined) {
|
||||
throw new Error('In Iframe API, got an error answer for a question that we have no track of.');
|
||||
}
|
||||
resolver.reject(payloadError);
|
||||
|
||||
answerPromises.delete(queryId);
|
||||
} else if (isIframeResponseEventWrapper(payload)) {
|
||||
const payloadData = payload.data;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue