From e6f3b7e2f61675591707253d5bc61232727dfc34 Mon Sep 17 00:00:00 2001 From: Tim Perry Date: Wed, 12 Jul 2023 16:05:02 +0200 Subject: [PATCH] Rename reportError to logError to avoid new global type There's a relatively recent addition to the DOM global types, due to a real method available for web workers, which means it's very very easy to accidentally call reportError without importing it, which fails everywhere except web workers, where it merely does completely the wrong thing. logError is exactly the same, but without that problem. --- src/api/api-model.ts | 10 +++++----- src/api/rest-api.ts | 4 ++-- src/browsers.ts | 10 +++++----- src/commands/start.ts | 18 +++++++++--------- src/error-tracking.ts | 2 +- src/index.ts | 4 ++-- src/interceptors/android/adb-commands.ts | 8 ++++---- .../android/android-adb-interceptor.ts | 6 +++--- src/interceptors/android/fetch-apk.ts | 8 ++++---- .../chromium-based-interceptors.ts | 4 ++-- .../docker/docker-interception-services.ts | 4 ++-- src/interceptors/docker/docker-networking.ts | 4 ++-- src/interceptors/docker/docker-proxy.ts | 4 ++-- src/interceptors/docker/docker-tunnel-proxy.ts | 4 ++-- src/interceptors/electron.ts | 4 ++-- src/interceptors/fresh-firefox.ts | 10 +++++----- src/interceptors/jvm.ts | 8 ++++---- .../terminal/fresh-terminal-interceptor.ts | 8 ++++---- src/interceptors/terminal/terminal-scripts.ts | 14 +++++++------- src/shutdown.ts | 4 ++-- 20 files changed, 69 insertions(+), 69 deletions(-) diff --git a/src/api/api-model.ts b/src/api/api-model.ts index 87e789ff..ad2aa2b3 100644 --- a/src/api/api-model.ts +++ b/src/api/api-model.ts @@ -6,7 +6,7 @@ import { getSystemProxy } from 'os-proxy-config'; import { SERVER_VERSION } from "../constants"; import { delay } from '../util/promise'; -import { reportError, addBreadcrumb } from '../error-tracking'; +import { logError, addBreadcrumb } from '../error-tracking'; import { HtkConfig } from "../config"; import { ActivationError, Interceptor } from "../interceptors"; import { getDnsServer } from '../dns-server'; @@ -170,7 +170,7 @@ export class ApiModel { // After 30s, don't stop activating, but report an error if we're not done yet let activationDone = false; delay(30000).then(() => { - if (!activationDone) reportError(`Timeout activating ${id}`) + if (!activationDone) logError(`Timeout activating ${id}`) }); try { @@ -183,7 +183,7 @@ export class ApiModel { activationDone = true; if (activationError.reportable !== false) { addBreadcrumb(`Failed to activate ${id}`, { category: 'interceptor' }); - reportError(err); + logError(err); } return { success: false, @@ -202,7 +202,7 @@ export class ApiModel { const interceptor = this.interceptors[id]; if (!interceptor) throw new Error(`Unknown interceptor ${id}`); - await interceptor.deactivate(proxyPort, options).catch(reportError); + await interceptor.deactivate(proxyPort, options).catch(logError); return { success: !interceptor.isActive(proxyPort) }; } @@ -219,7 +219,7 @@ export class ApiModel { const withFallback = (p: () => Promise, timeoutMs: number, defaultValue: R) => Promise.race([ p().catch((error) => { - reportError(error); + logError(error); return defaultValue; }), delay(timeoutMs).then(() => defaultValue) diff --git a/src/api/rest-api.ts b/src/api/rest-api.ts index e0b38a53..0b4e2442 100644 --- a/src/api/rest-api.ts +++ b/src/api/rest-api.ts @@ -12,7 +12,7 @@ import type { import type { ParsedQs } from 'qs'; import { ErrorLike, StatusError } from '../util/error'; -import { reportError } from '../error-tracking'; +import { logError } from '../error-tracking'; import { ApiModel } from './api-model'; import * as Client from '../client/client-types'; @@ -175,7 +175,7 @@ function handleErrors< const error = e as ErrorLike; console.log(`Error handling request to ${req.path}: ${error.message ?? error}`); - reportError(error); + logError(error); // Use default error handler if response started (kills the connection) if (res.headersSent) return next(error) diff --git a/src/browsers.ts b/src/browsers.ts index 607bcd84..676b1d41 100644 --- a/src/browsers.ts +++ b/src/browsers.ts @@ -10,7 +10,7 @@ import { update as updateBrowserCacheCb } from '@httptoolkit/browser-launcher'; -import { reportError } from './error-tracking'; +import { logError } from './error-tracking'; import { delay } from './util/promise'; import { isErrorLike } from './util/error'; import { readFile, deleteFile } from './util/fs'; @@ -40,7 +40,7 @@ export async function checkBrowserConfig(configPath: string) { if (isErrorLike(err) && err.code === 'ENOENT') return; console.error('Failed to clear broken config file:', err); - reportError(err); + logError(err); }); } } @@ -63,13 +63,13 @@ function getLauncher(configPath: string) { // Need to reload the launcher after updating the cache: launcher = getBrowserLauncher(browserConfig); } catch (e) { - reportError(e) + logError(e) } }); // Reset & retry if this fails somehow: launcher.catch((e) => { - reportError(e); + logError(e); launcher = undefined; }); } @@ -92,7 +92,7 @@ export const launchBrowser = async (url: string, options: LaunchOptions, configP // fallback error handling: log & report & don't crash. if (browserInstance.process.listenerCount('error') === 1) { console.log('Browser launch error'); - reportError(e); + logError(e); } }); diff --git a/src/commands/start.ts b/src/commands/start.ts index ed3b48c6..2de0ce23 100644 --- a/src/commands/start.ts +++ b/src/commands/start.ts @@ -22,7 +22,7 @@ function maybeBundleImport(moduleName: string): T { return require('../' + moduleName); } } -const { initErrorTracking, reportError } = maybeBundleImport('error-tracking'); +const { initErrorTracking, logError } = maybeBundleImport('error-tracking'); initErrorTracking(); import { Command, flags } from '@oclif/command' @@ -49,7 +49,7 @@ class HttpToolkitServer extends Command { configPath: flags.config, authToken: envToken || flags.token }).catch(async (error) => { - await reportError(error); + await logError(error); throw error; }); } @@ -65,7 +65,7 @@ class HttpToolkitServer extends Command { // Be careful - if the server path isn't clearly ours somehow, ignore it. if (!isOwnedPath(serverUpdatesPath)) { - reportError(`Unexpected server updates path (${serverUpdatesPath}), ignoring`); + logError(`Unexpected server updates path (${serverUpdatesPath}), ignoring`); return; } @@ -84,19 +84,19 @@ class HttpToolkitServer extends Command { filename !== '.DS_Store' // Meaningless Mac folder metadata )) { console.log(serverPaths); - reportError( + logError( `Server path (${serverUpdatesPath}) contains unexpected content, ignoring` ); return; } - const maybeReportError = (error: Error & { code?: string }) => { + const maybeLogError = (error: Error & { code?: string }) => { if ([ 'EBUSY', 'EPERM' ].includes(error.code!)) return; - else reportError(error); + else logError(error); }; if (serverPaths.every((filename) => { @@ -107,7 +107,7 @@ class HttpToolkitServer extends Command { // a new server standalone (not just from an update), because otherwise the // update dir can end up in a broken state. Better to clear it completely. console.log("Downloaded server directory is entirely outdated, deleting it"); - deleteFolder(serverUpdatesPath).catch(maybeReportError); + deleteFolder(serverUpdatesPath).catch(maybeLogError); } else { // Some of the servers are outdated, but not all (maybe it includes us). // Async delete all server versions older than this currently running version. @@ -116,7 +116,7 @@ class HttpToolkitServer extends Command { if (version && semver.lt(version, currentVersion)) { console.log(`Deleting old server ${filename}`); - deleteFolder(path.join(serverUpdatesPath, filename)).catch(maybeReportError); + deleteFolder(path.join(serverUpdatesPath, filename)).catch(maybeLogError); } }); } @@ -151,7 +151,7 @@ function isOwnedPath(input: string) { if (input.split(path.sep).includes('httptoolkit-server')) { return true; } else { - reportError(`Unexpected unowned path ${input}`); + logError(`Unexpected unowned path ${input}`); return false; } } diff --git a/src/error-tracking.ts b/src/error-tracking.ts index c08a4f3a..20d5eddb 100644 --- a/src/error-tracking.ts +++ b/src/error-tracking.ts @@ -113,7 +113,7 @@ export function addBreadcrumb(message: string, data: Sentry.Breadcrumb) { Sentry.addBreadcrumb(Object.assign({ message }, data)); } -export function reportError(error: Error | string | unknown): undefined | Promise { +export function logError(error: Error | string | unknown): undefined | Promise { console.warn(error); if (!sentryInitialized) return; diff --git a/src/index.ts b/src/index.ts index b77ab6b6..6e884306 100644 --- a/src/index.ts +++ b/src/index.ts @@ -18,7 +18,7 @@ import updateCommand from '@oclif/plugin-update/lib/commands/update'; import { HttpToolkitServerApi } from './api/api-server'; import { checkBrowserConfig } from './browsers'; -import { reportError } from './error-tracking'; +import { logError } from './error-tracking'; import { MOCKTTP_ALLOWED_ORIGINS } from './constants'; import { delay } from './util/promise'; @@ -207,7 +207,7 @@ export async function runHTK(options: { } console.log(error); - reportError('Failed to check for updates'); + logError('Failed to check for updates'); }) ); }); diff --git a/src/interceptors/android/adb-commands.ts b/src/interceptors/android/adb-commands.ts index a5cbce4e..349d9c4b 100644 --- a/src/interceptors/android/adb-commands.ts +++ b/src/interceptors/android/adb-commands.ts @@ -1,7 +1,7 @@ import * as stream from 'stream'; import * as path from 'path'; import adb, * as Adb from '@devicefarmer/adbkit'; -import { reportError } from '../../error-tracking'; +import { logError } from '../../error-tracking'; import { isErrorLike } from '../../util/error'; import { delay, waitUntil } from '../../util/promise'; import { getCertificateFingerprint, parseCert } from '../../certificates'; @@ -35,7 +35,7 @@ export function createAdbClient() { // We listen for errors and report them. This only happens if adbkit completely // fails to handle or listen to a connection error. We'd rather report that than crash. - client.on('error', reportError); + client.on('error', logError); return client; } @@ -92,7 +92,7 @@ export const getConnectedDevices = batchCalls(async (adbClient: Adb.Client) => { } return []; } else { - reportError(e); + logError(e); throw e; } } @@ -222,7 +222,7 @@ export async function getRootCommand(adbClient: Adb.DeviceClient): Promise { try { @@ -53,7 +53,7 @@ async function getLatestLocalApk(config: HtkConfig) { else return latestLocalApk; } catch (e) { console.log("Could not check for local Android app APK", e); - reportError(e); + logError(e); } } @@ -131,7 +131,7 @@ export async function streamLatestApk(config: HtkConfig): Promise { const apkStream = apkResponse.body; return updateLocalApk(latestApkRelease.version, apkStream, config); - }).catch(reportError); + }).catch(logError); console.log('Streaming local APK, and updating it async'); return fs.createReadStream(localApk.path); diff --git a/src/interceptors/chromium-based-interceptors.ts b/src/interceptors/chromium-based-interceptors.ts index ea4ec1ff..d5707a4e 100644 --- a/src/interceptors/chromium-based-interceptors.ts +++ b/src/interceptors/chromium-based-interceptors.ts @@ -15,7 +15,7 @@ import { readFile, deleteFolder } from '../util/fs'; import { listRunningProcesses, windowsClose, waitForExit } from '../util/process-management'; import { HideWarningServer } from '../hide-warning-server'; import { Interceptor } from '.'; -import { reportError } from '../error-tracking'; +import { logError } from '../error-tracking'; import { WEBEXTENSION_INSTALL } from '../webextension'; const getBrowserDetails = async (config: HtkConfig, variant: string): Promise => { @@ -135,7 +135,7 @@ abstract class FreshChromiumBasedInterceptor implements Interceptor { const profilePath = browserDetails.profile; if (!profilePath.startsWith(this.config.configPath)) { - reportError( + logError( `Unexpected ${this.variantName} profile location, not deleting: ${profilePath}` ); } else { diff --git a/src/interceptors/docker/docker-interception-services.ts b/src/interceptors/docker/docker-interception-services.ts index 21d826a2..74ebb397 100644 --- a/src/interceptors/docker/docker-interception-services.ts +++ b/src/interceptors/docker/docker-interception-services.ts @@ -1,7 +1,7 @@ import Docker from 'dockerode'; import { ProxySettingCallback } from 'mockttp'; -import { reportError } from '../../error-tracking'; +import { logError } from '../../error-tracking'; import { addShutdownHandler } from '../../shutdown'; import { DOCKER_BUILD_LABEL } from './docker-build-injection'; @@ -117,7 +117,7 @@ export async function ensureDockerServicesRunning(proxyPort: number) { getDnsServer(proxyPort), // We don't double-check on the injection volume here - that's // checked separately at the point of use instead. - ]).catch(reportError); + ]).catch(logError); } export async function stopDockerInterceptionServices( diff --git a/src/interceptors/docker/docker-networking.ts b/src/interceptors/docker/docker-networking.ts index bd926d33..91b26370 100644 --- a/src/interceptors/docker/docker-networking.ts +++ b/src/interceptors/docker/docker-networking.ts @@ -4,7 +4,7 @@ import Docker from 'dockerode'; import * as EventStream from 'event-stream'; import * as mobx from 'mobx'; -import { reportError } from '../../error-tracking'; +import { logError } from '../../error-tracking'; import { isInterceptedContainer } from './docker-commands'; import { isDockerAvailable } from './docker-interception-services'; @@ -96,7 +96,7 @@ export async function monitorDockerNetworkAliases(proxyPort: number): Promise { console.log(`Docker stream for port ${proxyPort} hit an error`); - reportError(e); + logError(e); }); const dnsServer = await getDnsServer(proxyPort); diff --git a/src/interceptors/docker/docker-proxy.ts b/src/interceptors/docker/docker-proxy.ts index 7f424a50..b0b34225 100644 --- a/src/interceptors/docker/docker-proxy.ts +++ b/src/interceptors/docker/docker-proxy.ts @@ -12,7 +12,7 @@ import { makeDestroyable, DestroyableServer } from 'destroyable-server'; import { chmod, deleteFile, readDir } from '../../util/fs'; import { rawHeadersToHeaders } from '../../util/http'; import { streamToBuffer } from '../../util/stream'; -import { reportError } from '../../error-tracking'; +import { logError } from '../../error-tracking'; import { addShutdownHandler } from '../../shutdown'; import { @@ -153,7 +153,7 @@ async function createDockerProxy( if (reqPath.match(BUILD_IMAGE_MATCHER)) { if (reqUrl.searchParams.get('remote')) { res.writeHead(400); - reportError("Build interception failed due to unsupported 'remote' param"); + logError("Build interception failed due to unsupported 'remote' param"); if (reqUrl.searchParams.get('remote') === 'client-session') { res.end("HTTP Toolkit does not yet support BuildKit-powered builds"); diff --git a/src/interceptors/docker/docker-tunnel-proxy.ts b/src/interceptors/docker/docker-tunnel-proxy.ts index 457feb49..bdfd810b 100644 --- a/src/interceptors/docker/docker-tunnel-proxy.ts +++ b/src/interceptors/docker/docker-tunnel-proxy.ts @@ -5,7 +5,7 @@ import { Mutex } from 'async-mutex'; import { isImageAvailable } from './docker-commands'; import { isDockerAvailable } from './docker-interception-services'; import { delay } from '../../util/promise'; -import { reportError } from '../../error-tracking'; +import { logError } from '../../error-tracking'; import { waitForDockerStream } from './docker-utils'; const DOCKER_TUNNEL_IMAGE = "httptoolkit/docker-socks-tunnel:v1.2.0"; @@ -100,7 +100,7 @@ export function ensureDockerTunnelRunning(proxyPort: number) { }) ); portCache[proxyPort] = refreshTunnelPort; - refreshTunnelPort.catch(reportError); + refreshTunnelPort.catch(logError); } }).finally(() => { // Clean up the promise, so that future calls to ensureRunning re-run this check. diff --git a/src/interceptors/electron.ts b/src/interceptors/electron.ts index 9e5512eb..97d4a3d6 100644 --- a/src/interceptors/electron.ts +++ b/src/interceptors/electron.ts @@ -14,7 +14,7 @@ import { ErrorLike, isErrorLike } from '../util/error'; import { canAccess, readFile } from '../util/fs'; import { windowsClose } from '../util/process-management'; import { getTerminalEnvVars, OVERRIDES_DIR } from './terminal/terminal-env-overrides'; -import { reportError, addBreadcrumb } from '../error-tracking'; +import { logError, addBreadcrumb } from '../error-tracking'; import { findExecutableInApp } from '@httptoolkit/osx-find-executable'; const isAppBundle = (path: string) => { @@ -83,7 +83,7 @@ export class ElectronInterceptor implements Interceptor { let spawnError: ErrorLike | undefined; appProcess.on('error', async (e) => { - reportError(e); + logError(e); if (debugClient) { // Try to close the debug connection if open, but very carefully diff --git a/src/interceptors/fresh-firefox.ts b/src/interceptors/fresh-firefox.ts index 7c8477a9..90b0a7f1 100644 --- a/src/interceptors/fresh-firefox.ts +++ b/src/interceptors/fresh-firefox.ts @@ -4,7 +4,7 @@ import { SpawnOptions } from 'child_process'; import { APP_ROOT } from '../constants'; import { HtkConfig } from '../config'; -import { reportError } from '../error-tracking'; +import { logError } from '../error-tracking'; import { getAvailableBrowsers, launchBrowser, BrowserInstance } from '../browsers'; import { delay } from '../util/promise'; @@ -191,7 +191,7 @@ export class FreshFirefox implements Interceptor { ); await messageServer.start(); - let messageShown: Promise | true = messageServer.waitForSuccess().catch(reportError); + let messageShown: Promise | true = messageServer.waitForSuccess().catch(logError); profileSetupBrowser = await this.startFirefox(messageServer); profileSetupBrowser.process.once('close', (exitCode) => { @@ -200,7 +200,7 @@ export class FreshFirefox implements Interceptor { profileSetupBrowser = undefined; if (messageShown !== true) { - reportError(`Firefox profile setup failed with code ${exitCode}`); + logError(`Firefox profile setup failed with code ${exitCode}`); deleteFolder(this.firefoxProfilePath).catch(console.warn); } }); @@ -279,7 +279,7 @@ export class FreshFirefox implements Interceptor { certCheckSuccessful = true; }).catch((e) => { certCheckSuccessful = false; - reportError(e); + logError(e); }); browsers[proxyPort] = browser; @@ -295,7 +295,7 @@ export class FreshFirefox implements Interceptor { certCheckServer.stop(); if (!certCheckSuccessful) { - reportError(`Firefox certificate check ${ + logError(`Firefox certificate check ${ certCheckSuccessful === false ? "failed" : "did not complete" diff --git a/src/interceptors/jvm.ts b/src/interceptors/jvm.ts index 3e2c73a7..65ff75a7 100644 --- a/src/interceptors/jvm.ts +++ b/src/interceptors/jvm.ts @@ -6,7 +6,7 @@ import { Interceptor } from '.'; import { HtkConfig } from '../config'; import { spawnToResult, waitForExit } from '../util/process-management'; import { OVERRIDE_JAVA_AGENT } from './terminal/terminal-env-overrides'; -import { reportError } from '../error-tracking'; +import { logError } from '../error-tracking'; import { delay } from '../util/promise'; import { commandExists, canAccess } from '../util/fs'; import { ErrorLike } from '../util/error'; @@ -89,7 +89,7 @@ const javaBinPromise: Promise = (async () => { } else { // If we find any other unexpected Java errors, we report them, to aid with debugging and // detecting issues with unusual JVMs. - reportError(new Error(`JVM attach test failed unusually - exited with ${unusualJavaErrors[0].output.exitCode}`)); + logError(new Error(`JVM attach test failed unusually - exited with ${unusualJavaErrors[0].output.exitCode}`)); } return false; } else if (bestJava) { @@ -99,7 +99,7 @@ const javaBinPromise: Promise = (async () => { return false; } })().catch((e) => { - reportError(e); + logError(e); return false; }); @@ -183,7 +183,7 @@ export class JvmInterceptor implements Interceptor { ); if (listTargetsOutput.exitCode !== 0) { - reportError(`JVM target lookup failed with status ${listTargetsOutput.exitCode}`); + logError(`JVM target lookup failed with status ${listTargetsOutput.exitCode}`); return []; } diff --git a/src/interceptors/terminal/fresh-terminal-interceptor.ts b/src/interceptors/terminal/fresh-terminal-interceptor.ts index 11449547..d85e1f22 100644 --- a/src/interceptors/terminal/fresh-terminal-interceptor.ts +++ b/src/interceptors/terminal/fresh-terminal-interceptor.ts @@ -6,7 +6,7 @@ import { findExecutableById } from '@httptoolkit/osx-find-executable'; import { Interceptor } from '..'; import { HtkConfig } from '../../config'; -import { reportError, addBreadcrumb } from '../../error-tracking'; +import { logError, addBreadcrumb } from '../../error-tracking'; import { isErrorLike } from '../../util/error'; import { canAccess, commandExists } from '../../util/fs'; import { spawnToResult } from '../../util/process-management'; @@ -33,7 +33,7 @@ const getTerminalCommand = _.memoize(async (): Promise => { result.then((terminal) => { if (terminal) addBreadcrumb('Found terminal', { data: { terminal } }); - else reportError('No terminal could be detected'); + else logError('No terminal could be detected'); }); return result; @@ -127,7 +127,7 @@ const getXTerminalCommand = async (command = 'x-terminal-emulator'): Promise { - reportError(e); + logError(e); onTerminalClosed(); }); diff --git a/src/interceptors/terminal/terminal-scripts.ts b/src/interceptors/terminal/terminal-scripts.ts index e9afe428..ae47398f 100644 --- a/src/interceptors/terminal/terminal-scripts.ts +++ b/src/interceptors/terminal/terminal-scripts.ts @@ -5,7 +5,7 @@ import * as os from 'os'; import * as path from 'path'; import { canAccess, writeFile, renameFile, readFile, getRealPath } from '../../util/fs'; -import { reportError } from '../../error-tracking'; +import { logError } from '../../error-tracking'; import { OVERRIDE_BIN_PATH } from './terminal-env-overrides'; // Generate POSIX paths for git-bash on Windows (or use the normal path everywhere else) @@ -159,7 +159,7 @@ export const editShellStartupScripts = async () => { ], true, // We always write .profile SH_SHELL_PATH_CONFIG - ).catch(reportError); + ).catch(logError); // Bash login shells use some other files by preference, if they exist. // Note that on OSX, all shells are login - elsewhere they only are at actual login time. @@ -170,7 +170,7 @@ export const editShellStartupScripts = async () => { ], false, // Do nothing if they don't exist - it falls back to .profile SH_SHELL_PATH_CONFIG - ).catch(reportError); + ).catch(logError); // Bash non-login shells use .bashrc, if it exists: appendToFirstExisting( @@ -179,7 +179,7 @@ export const editShellStartupScripts = async () => { ], SHELL === 'bash', // If you use bash, we _always_ want to set this SH_SHELL_PATH_CONFIG - ).catch(reportError); + ).catch(logError); // Zsh has its own files (both are actually used) appendToFirstExisting( @@ -189,7 +189,7 @@ export const editShellStartupScripts = async () => { ], SHELL === 'zsh', // If you use zsh, we _always_ write a config file SH_SHELL_PATH_CONFIG - ).catch(reportError); + ).catch(logError); // Fish always uses the same config file appendToFirstExisting( @@ -198,7 +198,7 @@ export const editShellStartupScripts = async () => { ], SHELL === 'fish' || await canAccess(path.join(os.homedir(), '.config', 'fish')), FISH_SHELL_PATH_CONFIG - ).catch(reportError); + ).catch(logError); }; const removeConfigSectionsFromFile = async (path: string) => { @@ -245,6 +245,6 @@ export const resetShellStartupScripts = () => { path.join(os.homedir(), '.zshrc'), path.join(os.homedir(), '.config', 'fish', 'config.fish'), ].map((configFile) => - removeConfigSectionsFromFile(configFile).catch(reportError) + removeConfigSectionsFromFile(configFile).catch(logError) )); }; \ No newline at end of file diff --git a/src/shutdown.ts b/src/shutdown.ts index a3bd8091..d86f99d9 100644 --- a/src/shutdown.ts +++ b/src/shutdown.ts @@ -1,4 +1,4 @@ -import { reportError } from './error-tracking'; +import { logError } from './error-tracking'; import { delay } from './util/promise'; type ShutdownHandler = () => Promise; @@ -21,7 +21,7 @@ export async function shutdown(cause: string) { try { await handler(); } catch (e) { - reportError(e); + logError(e); } } ));