Skip to content

Commit

Permalink
chore: merged if statements for Error and LogReturn instances
Browse files Browse the repository at this point in the history
  • Loading branch information
gentlementlegen committed Jan 2, 2025
1 parent a06e498 commit 9174d44
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/helpers/runtime-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class CfRuntimeInfo extends PluginRuntimeInfo {
}
public get runUrl(): string {
const accountId = this._env.CLOUDFLARE_ACCOUNT_ID ?? "<missing-cloudflare-account-id>";
const workerName = this._env.CLOUFLARE_WORKER_NAME;
const workerName = this._env.CLOUDFLARE_WORKER_NAME;
const toTime = Date.now() + 60000;
const fromTime = Date.now() - 60000;
const timeParam = encodeURIComponent(`{"type":"absolute","to":${toTime},"from":${fromTime}}`);
Expand Down
6 changes: 2 additions & 4 deletions src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export function createPlugin<TConfig = unknown, TEnv = unknown, TCommand = unkno
} else {
workerName = `${workerUrl.split("//")[1].split(".")[0]}`;
}
PluginRuntimeInfo.getInstance({ ...env, CLOUFLARE_WORKER_NAME: workerName });
PluginRuntimeInfo.getInstance({ ...env, CLOUDFLARE_WORKER_NAME: workerName });

let command: TCommand | null = null;
if (inputs.command && pluginOptions.commandSchema) {
Expand Down Expand Up @@ -119,9 +119,7 @@ export function createPlugin<TConfig = unknown, TEnv = unknown, TCommand = unkno
console.error(error);

let loggerError: LogReturn | Error | null;
if (error instanceof Error) {
loggerError = error;
} else if (error instanceof LogReturn) {
if (error instanceof Error || error instanceof LogReturn) {
loggerError = error;
} else {
loggerError = context.logger.error(`Error: ${error}`);
Expand Down

0 comments on commit 9174d44

Please sign in to comment.