Skip to content

Commit

Permalink
Catch errors in script loading & resumption
Browse files Browse the repository at this point in the history
Should be very very rare, since syntax errors happen earlier and runtime
errors later, but could for a failing process or disconnection maybe,
and it's better to log than just crash the process.
  • Loading branch information
pimterry committed May 31, 2024
1 parent 94499cc commit d061feb
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,11 @@ export class FridaSession {
const script = await agentSession.createScript(fridaScript, {});

setTimeout(async () => {
await script.loadScript();
try {
await script.loadScript();
} catch (e) {
console.warn(e);
}
}, 0);

return {
Expand Down Expand Up @@ -238,8 +242,12 @@ export class FridaSession {
const script = await agentSession.createScript(fridaScript, {});

setTimeout(async () => {
await script.loadScript();
await hostSession.Resume(pid);
try {
await script.loadScript();
await hostSession.Resume(pid);
} catch (e) {
console.warn(e);
}
}, 0);

return {
Expand Down

0 comments on commit d061feb

Please sign in to comment.