mirror of
https://github.com/swc-project/swc.git
synced 2024-12-30 00:52:29 +03:00
bbaf619f63
swc_bundler: - [x] Fix wrapped esms. (denoland/deno#9307) - [x] Make test secure.
33 lines
662 B
TypeScript
33 lines
662 B
TypeScript
// Loaded from https://deno.land/x/args@1.0.7/command-errors.ts
|
|
|
|
|
|
import {
|
|
ParseError,
|
|
} from "./types.ts";
|
|
|
|
import {
|
|
FlagError,
|
|
} from "./flag-errors.ts";
|
|
|
|
/**
|
|
* Class of error created by `CommandType::extract`
|
|
* @template ErrList Type of array of {@link FlagError}
|
|
*/
|
|
export class CommandError<
|
|
ErrList extends readonly FlagError[],
|
|
> implements ParseError, Iterable<FlagError> {
|
|
constructor(
|
|
/** Array of {@link FlagError} */
|
|
public readonly errors: ErrList,
|
|
) {}
|
|
|
|
public readonly toString = () =>
|
|
this.errors
|
|
.map((error) => error.toString())
|
|
.join("\n");
|
|
|
|
public *[Symbol.iterator]() {
|
|
yield* this.errors;
|
|
}
|
|
}
|