generated from boneskull/boneskull-template
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
46 changed files
with
1,534 additions
and
615 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import {BaseSmokerError} from './base-error'; | ||
|
||
/** | ||
* Thrown when `Smoker.cleanup()` fails. | ||
* | ||
* @group Errors | ||
*/ | ||
|
||
export class CleanupError extends BaseSmokerError< | ||
{ | ||
dir: string; | ||
}, | ||
NodeJS.ErrnoException | ||
> { | ||
public readonly id = 'CleanupError'; | ||
|
||
constructor(message: string, dir: string, error: NodeJS.ErrnoException) { | ||
super(message, {dir}, error); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,22 @@ | ||
import {type StaticPkgManagerSpec} from '#schema/static-pkg-manager-spec'; | ||
import {isString} from 'lodash'; | ||
import {BaseSmokerError} from './base-error'; | ||
|
||
/** | ||
* @group Errors | ||
*/ | ||
|
||
export class DirCreationError extends BaseSmokerError< | ||
{prefix: string}, | ||
export class TempDirError extends BaseSmokerError< | ||
{spec: string}, | ||
NodeJS.ErrnoException | ||
> { | ||
public readonly id = 'DirCreationError'; | ||
public readonly id = 'TempDirError'; | ||
|
||
constructor(message: string, prefix: string, error: NodeJS.ErrnoException) { | ||
super(message, {prefix}, error); | ||
constructor( | ||
message: string, | ||
spec: string | StaticPkgManagerSpec, | ||
error: NodeJS.ErrnoException, | ||
) { | ||
super(message, {spec: isString(spec) ? spec : spec.spec}, error); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import {type StaticPluginMetadata} from '#schema/static-plugin-metadata'; | ||
import {BaseSmokerError} from './base-error'; | ||
|
||
export type LifecycleStage = 'setup' | 'teardown'; | ||
|
||
export type LifecycleComponentKind = 'reporter' | 'pkg-manager'; | ||
|
||
export class LifecycleError extends BaseSmokerError< | ||
{ | ||
name: string; | ||
stage: LifecycleStage; | ||
plugin: StaticPluginMetadata; | ||
kind: LifecycleComponentKind; | ||
}, | ||
Error | ||
> { | ||
public readonly id = 'LifecycleError'; | ||
|
||
constructor( | ||
error: Error, | ||
stage: LifecycleStage, | ||
kind: LifecycleComponentKind, | ||
name: string, | ||
plugin: StaticPluginMetadata, | ||
) { | ||
super( | ||
`Error during lifecycle hook "${stage}"`, | ||
{ | ||
name, | ||
kind, | ||
stage, | ||
plugin, | ||
}, | ||
error, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import {castArray} from 'lodash'; | ||
import {AggregateSmokerError} from './base-error'; | ||
|
||
/** | ||
* Generic aggregate error for machines | ||
* | ||
* @group Errors | ||
*/ | ||
export class MachineError extends AggregateSmokerError<{ | ||
machineId: string; | ||
}> { | ||
public readonly id = 'MachineError'; | ||
|
||
public override readonly context: { | ||
machineId: string; | ||
}; | ||
|
||
static originators = new WeakMap<Error, string>(); | ||
|
||
constructor(message: string, errors: Error[] | Error, machineId: string) { | ||
errors = castArray(errors); | ||
for (const error of errors) { | ||
MachineError.originators.set(error, machineId); | ||
} | ||
super(message, errors, {machineId}); | ||
this.context = {machineId}; | ||
} | ||
|
||
/** | ||
* Clone this instance with additional errors and options. | ||
* | ||
* @param error Zero or more errors to append to the aggregate | ||
* @param options Results of linting and running scripts, if any | ||
* @returns New instance of `SmokeError` with the given errors and options | ||
*/ | ||
clone(error: Error | Error[] = []): MachineError { | ||
return new MachineError( | ||
this.message, | ||
[...this.errors, ...castArray(error)], | ||
this.context.machineId, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.