mirror of
https://github.com/langgenius/dify.git
synced 2026-07-22 03:08:33 +08:00
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
24 lines
814 B
TypeScript
24 lines
814 B
TypeScript
import type { FlagDefinition } from './types'
|
|
import { BaseError } from '@/errors/base'
|
|
import { ErrorCode } from '@/errors/codes'
|
|
|
|
export class OutputFormatNotSupportedError extends BaseError {
|
|
constructor(format: string) {
|
|
super({
|
|
code: ErrorCode.IllegalArgumentError,
|
|
message: `format ${format} is not supported by this command`,
|
|
})
|
|
}
|
|
}
|
|
|
|
export class UnsupportedArgValueError extends BaseError {
|
|
constructor(flagName: string, flagDef: FlagDefinition, givenValue: string) {
|
|
const flagLabel = flagDef.char ? `--${flagName} / -${flagDef.char}` : `--${flagName}`
|
|
super({
|
|
code: ErrorCode.IllegalArgumentError,
|
|
message: `illegal value ${givenValue} for flag ${flagLabel}`,
|
|
hint: flagDef.options ? `supported value: ${flagDef.options.join(', ')}` : '',
|
|
})
|
|
}
|
|
}
|