From 815a585b65be3050dad2c81bb868eb073e9a0bed Mon Sep 17 00:00:00 2001 From: hasezoey Date: Tue, 15 Aug 2023 10:59:27 +0200 Subject: [PATCH] style: apply prettier 3.0.1 formatting --- .../src/__tests__/MongoMemoryServer.test.ts | 3 +- .../src/util/errors.ts | 45 +++++++++++++++---- 2 files changed, 37 insertions(+), 11 deletions(-) diff --git a/packages/mongodb-memory-server-core/src/__tests__/MongoMemoryServer.test.ts b/packages/mongodb-memory-server-core/src/__tests__/MongoMemoryServer.test.ts index 3706db889..fb1e0e300 100644 --- a/packages/mongodb-memory-server-core/src/__tests__/MongoMemoryServer.test.ts +++ b/packages/mongodb-memory-server-core/src/__tests__/MongoMemoryServer.test.ts @@ -145,8 +145,7 @@ describe('MongoMemoryServer', () => { }, }); - const args = - // @ts-expect-error "_instanceInfo" is protected + const args = // @ts-expect-error "_instanceInfo" is protected mongoServer._instanceInfo?.instance // separator comment .prepareCommandArgs(); diff --git a/packages/mongodb-memory-server-core/src/util/errors.ts b/packages/mongodb-memory-server-core/src/util/errors.ts index a205d8643..0b44af0af 100644 --- a/packages/mongodb-memory-server-core/src/util/errors.ts +++ b/packages/mongodb-memory-server-core/src/util/errors.ts @@ -1,7 +1,10 @@ import { isNullOrUndefined } from './utils'; export class StateError extends Error { - constructor(public wantedStates: string[], public gotState: string) { + constructor( + public wantedStates: string[], + public gotState: string + ) { super( `Incorrect State for operation: "${gotState}", allowed States: "[${wantedStates.join( ',' @@ -19,7 +22,10 @@ export class UnknownLockfileStatusError extends Error { } export class UnableToUnlockLockfileError extends Error { - constructor(public thisInstance: boolean, public file: string) { + constructor( + public thisInstance: boolean, + public file: string + ) { super( `Cannot unlock file "${file}", because it is not locked by this ${ thisInstance ? 'instance' : 'process' @@ -35,7 +41,10 @@ export class UnknownPlatformError extends Error { } export class UnknownArchitectureError extends Error { - constructor(public arch: string, public platform?: string) { + constructor( + public arch: string, + public platform?: string + ) { super(); if (!isNullOrUndefined(platform)) { @@ -47,13 +56,19 @@ export class UnknownArchitectureError extends Error { } export class WaitForPrimaryTimeoutError extends Error { - constructor(public timeout: number, public where?: string) { + constructor( + public timeout: number, + public where?: string + ) { super(`Timed out after ${timeout}ms while waiting for a Primary (where: "${where}")`); } } export class Md5CheckFailedError extends Error { - constructor(public binarymd5: string, public checkfilemd5: string) { + constructor( + public binarymd5: string, + public checkfilemd5: string + ) { super(`MD5 check failed! Binary MD5 is "${binarymd5}", Checkfile MD5 is "${checkfilemd5}"`); } } @@ -89,7 +104,10 @@ export class InsufficientPermissionsError extends Error { } export class BinaryNotFoundError extends Error { - constructor(public path: string, public extra: string = '') { + constructor( + public path: string, + public extra: string = '' + ) { super(`No Binary at path "${path}" was found! (ENOENT)${extra}`); } } @@ -116,7 +134,10 @@ export class ParseArchiveRegexError extends Error { } export class NoRegexMatchError extends Error { - constructor(public name: string, public extra?: string) { + constructor( + public name: string, + public extra?: string + ) { super(); const addExtra = !!extra ? `(${extra})` : ''; this.message = `Expected "${name}" to have Regex Matches${addExtra}`; @@ -181,7 +202,10 @@ export class UnknownVersionError extends Error { * Error for when downloading fails */ export class DownloadError extends Error { - constructor(public url: string, public msg: string) { + constructor( + public url: string, + public msg: string + ) { super(`Download failed for url \"${url}\", Details:\n${msg}`); } } @@ -190,7 +214,10 @@ export class DownloadError extends Error { * Error for when the linux distro is unknown */ export class UnknownLinuxDistro extends Error { - constructor(public distro: string, public id_like: string[]) { + constructor( + public distro: string, + public id_like: string[] + ) { super(`Unknown/unsupported linux "${distro}" id_like's: [${id_like?.join(', ')}]`); } }