Skip to content

Commit dde9add

Browse files
committed
Address lint errors
1 parent 17ed0e3 commit dde9add

File tree

2 files changed

+20
-25
lines changed

2 files changed

+20
-25
lines changed

client/src/core.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ export class SharedCore {
160160
* Represents the client instance on which a call is made.
161161
*/
162162
export class InnerClient {
163-
constructor(
163+
public constructor(
164164
public id: number,
165165
public readonly core: SharedCore,
166166
public config: ClientAuthConfig,
@@ -169,7 +169,7 @@ export class InnerClient {
169169
public async invoke(config: InvokeConfig): Promise<string> {
170170
try {
171171
return await this.core.invoke(config);
172-
} catch (err: any) {
172+
} catch (err: unknown) {
173173
if (err instanceof DesktopSessionExpired) {
174174
const newId = await this.core.initClient(this.config);
175175
this.id = parseInt(newId, 10);

client/src/shared_lib_core.ts

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -143,33 +143,28 @@ export class SharedLibCore implements Core {
143143

144144
const inputBuf = Buffer.from(JSON.stringify(req), "utf8");
145145

146-
try {
147-
const nativeResponse = await this.lib.sendMessage(inputBuf);
146+
const nativeResponse = await this.lib.sendMessage(inputBuf);
148147

149-
if (!(nativeResponse instanceof Uint8Array)) {
150-
throw new Error(
151-
`Native function returned an unexpected type. Expected Uint8Array, got ${typeof nativeResponse}`,
152-
);
153-
}
148+
if (!(nativeResponse instanceof Uint8Array)) {
149+
throw new Error(
150+
`Native function returned an unexpected type. Expected Uint8Array, got ${typeof nativeResponse}`,
151+
);
152+
}
154153

155-
const respString = new TextDecoder().decode(nativeResponse);
156-
const response = JSON.parse(respString) as SharedLibResponse;
154+
const respString = new TextDecoder().decode(nativeResponse);
155+
const response = JSON.parse(respString) as SharedLibResponse;
157156

158-
if (response.success) {
159-
const decodedPayload = Buffer.from(response.payload).toString("utf8");
160-
// On success, the payload is the actual result string
161-
return decodedPayload;
162-
} else {
163-
// On failure, convert the error payload to a readable string and throw
164-
const errorMessage = Array.isArray(response.payload)
165-
? String.fromCharCode(...response.payload)
166-
: JSON.stringify(response.payload);
157+
if (response.success) {
158+
const decodedPayload = Buffer.from(response.payload).toString("utf8");
159+
// On success, the payload is the actual result string
160+
return decodedPayload;
161+
} else {
162+
// On failure, convert the error payload to a readable string and throw
163+
const errorMessage = Array.isArray(response.payload)
164+
? String.fromCharCode(...response.payload)
165+
: JSON.stringify(response.payload);
167166

168-
throwError(errorMessage);
169-
}
170-
} catch (e) {
171-
// Catch errors from the native call or from JSON parsing
172-
throw e;
167+
throwError(errorMessage);
173168
}
174169
}
175170

0 commit comments

Comments
 (0)