Skip to content

Commit

Permalink
Only executes when response is null
Browse files Browse the repository at this point in the history
Signed-off-by: Konstantina Blazhukova <konstantina.blajukova@gmail.com>
  • Loading branch information
konstantinabl committed Oct 21, 2024
1 parent e1e5736 commit c66cad2
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions packages/relay/src/lib/clients/sdkClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -757,25 +757,24 @@ export class SDKClient {
);

if (!transactionResponse) {
const transactionId = transaction.transactionId ? transaction.transactionId.toString() : false;
console.log('Transaction id', transactionId);

Check warning on line 761 in packages/relay/src/lib/clients/sdkClient.ts

View check run for this annotation

Codecov / codecov/patch

packages/relay/src/lib/clients/sdkClient.ts#L761

Added line #L761 was not covered by tests
if (transactionId) {
try {
const transactionFromMirrorNode = await this.mirrorNodeClient.getTransactionById(

Check warning on line 764 in packages/relay/src/lib/clients/sdkClient.ts

View check run for this annotation

Codecov / codecov/patch

packages/relay/src/lib/clients/sdkClient.ts#L763-L764

Added lines #L763 - L764 were not covered by tests
transactionId,
requestDetails,
);
this.logger.warn('Transaction found', transactionFromMirrorNode);

Check warning on line 768 in packages/relay/src/lib/clients/sdkClient.ts

View check run for this annotation

Codecov / codecov/patch

packages/relay/src/lib/clients/sdkClient.ts#L768

Added line #L768 was not covered by tests
} catch (e) {
this.logger.warn('Transaction not found in mirror node', e);

Check warning on line 770 in packages/relay/src/lib/clients/sdkClient.ts

View check run for this annotation

Codecov / codecov/patch

packages/relay/src/lib/clients/sdkClient.ts#L770

Added line #L770 was not covered by tests
}
}
throw predefined.INTERNAL_ERROR(
`${requestDetails.formattedRequestId} TTransaction execution returns a null value: transactionId=${transaction.transactionId}, callerName=${callerName}, txConstructorName=${txConstructorName}`,
);
}

const transactionId = transaction.transactionId ? transaction.transactionId.toString() : false;
console.log('Transaction id', transactionId);
if (transactionId) {
try {
const transactionFromMirrorNode = await this.mirrorNodeClient.getTransactionById(
transactionId,
requestDetails,
);
this.logger.warn('Transaction found', transactionFromMirrorNode);
} catch (e) {
this.logger.warn('Transaction not found in mirror node', e);
}
}

return transactionResponse;
} finally {
if (transactionId?.length) {
Expand Down

0 comments on commit c66cad2

Please sign in to comment.