Skip to content

Commit

Permalink
style: apply prettier 3.0.1 formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
hasezoey committed Aug 15, 2023
1 parent 1cd459b commit 815a585
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
45 changes: 36 additions & 9 deletions packages/mongodb-memory-server-core/src/util/errors.ts
Original file line number Diff line number Diff line change
@@ -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(
','
Expand All @@ -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'
Expand All @@ -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)) {
Expand All @@ -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}"`);
}
}
Expand Down Expand Up @@ -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}`);
}
}
Expand All @@ -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}`;
Expand Down Expand Up @@ -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}`);
}
}
Expand All @@ -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(', ')}]`);
}
}
Expand Down

0 comments on commit 815a585

Please sign in to comment.