Skip to content

Commit

Permalink
improve stability
Browse files Browse the repository at this point in the history
  • Loading branch information
YunFeng0817 committed Jan 9, 2025
1 parent 556e8b5 commit 63721e8
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions packages/web-extension/src/background/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,14 @@ void (async () => {
await Browser.storage.local.set({
[LocalDataKey.recorderStatus]: recorderStatus,
});
const title = (
await Browser.tabs.query({
active: true,
currentWindow: true,
})
)[0].title;
const newSession = generateSession(title || '');
const title =
(await Browser.tabs
.query({ active: true, currentWindow: true })
.then((tabs) => tabs[0]?.title)
.catch(() => {
// ignore error
})) ?? 'new session';
const newSession = generateSession(title);
await saveSession(newSession, events).catch((e) => {
recorderStatus.errorMessage = (e as { message: string }).message;
void Browser.storage.local.set({
Expand Down

0 comments on commit 63721e8

Please sign in to comment.