Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions src/main_thread/decrypt/session_events_listener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,23 +111,23 @@ export default function SessionEventsListener(
() => runGetLicense(message, messageType),
backoffOptions,
manualCanceller.signal,
)
.then((licenseObject) => {
).then(
async (licenseObject) => {
if (manualCanceller.isUsed()) {
return Promise.resolve();
return;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NOTE: removed because unnecessary

}
if (isNullOrUndefined(licenseObject)) {
log.info("DRM: No license given, skipping session.update");
} else {
try {
return updateSessionWithMessage(session, licenseObject);
await updateSessionWithMessage(session, licenseObject);
Copy link
Collaborator Author

@peaBerberian peaBerberian Mar 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NOTE: awaited to make the try / catch catch rejections, not just errors thrown synchronously. Also, we don't actually care about the returned value

} catch (err) {
manualCanceller.cancel();
callbacks.onError(err);
}
}
})
.catch((err: unknown) => {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea is to now do licenseFetchingPromise.then(onSucceed, onFailure) instead of: licenseFetchingPromise.then(onSucceed).catch(onFailure).

},
(err: unknown) => {
if (manualCanceller.isUsed()) {
return;
}
Expand All @@ -148,7 +148,8 @@ export default function SessionEventsListener(
}
}
callbacks.onError(formattedError);
});
},
);
},
manualCanceller.signal,
);
Expand Down
Loading