Skip to content

Commit 00f3e15

Browse files
committed
Report a clear error if Frida v16 API isn't available
1 parent 5581cfe commit 00f3e15

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/index.ts

+10-4
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,16 @@ export class FridaSession {
139139
return this.bus.disconnect();
140140
}
141141

142-
private getHostSession() {
143-
return this.bus
144-
.getService('re.frida.HostSession16')
145-
.getInterface<HostSession>('/re/frida/HostSession', 're.frida.HostSession16');
142+
private async getHostSession() {
143+
const hostSession = await this.bus
144+
.getService('re.frida.HostSession16')
145+
.getInterface<HostSession | undefined>('/re/frida/HostSession', 're.frida.HostSession16');
146+
147+
if (!hostSession) {
148+
throw new Error('Frida host does not support v16 API');
149+
}
150+
151+
return hostSession;
146152
}
147153

148154
private async getAgentSession(sessionId: string, pid: number, hostSession: HostSession) {

0 commit comments

Comments
 (0)