Skip to content

Commit

Permalink
Don't stringify all options as target can be Window and won't stringify
Browse files Browse the repository at this point in the history
  • Loading branch information
johnman committed Jun 10, 2024
1 parent 43bf5fd commit 45c1ac9
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions how-to/web-client-api/client/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,11 @@ export async function getAPI<FDC3 = typeof OpenFin.FDC3.v2_0>(
let newFin: _Fin | undefined;
try {
options.logger.info(
`Creating Fin API instance through @openfin/core-web connect using the following options: ${JSON.stringify(options)}.`
`Creating Fin API instance through @openfin/core-web connect using the following options.
Connect Options:
${JSON.stringify(options.connectOptions)}
Request Connect Options:
${JSON.stringify(options.requestConnectOptions)}`
);
if (options.connectOptions !== undefined) {
newFin = (await connect(options.connectOptions)) as unknown as _Fin;
Expand All @@ -236,13 +240,21 @@ export async function getAPI<FDC3 = typeof OpenFin.FDC3.v2_0>(
newFin = (await connect(requestedConnectConfig)) as unknown as _Fin;
} catch (requestError) {
options.logger.error(
`Error creating Fin API instance through @openfin/core-web connect using the following options: ${JSON.stringify(options)}.`,
`Error creating Fin API instance through @openfin/core-web connect using the following options:
Connect Options:
${JSON.stringify(options.connectOptions)}
Request Connect Options:
${JSON.stringify(options.requestConnectOptions)}`,
requestError as Error
);
}
} else {
options.logger.error(
`Error creating Fin API instance through @openfin/core-web connect using the following options: ${JSON.stringify(options)}.`,
`Error creating Fin API instance through @openfin/core-web connect using the following options:
Connect Options:
${JSON.stringify(options.connectOptions)}
Request Connect Options:
${JSON.stringify(options.requestConnectOptions)}`,
err as Error
);
}
Expand Down

0 comments on commit 45c1ac9

Please sign in to comment.