MCPcopy Create free account
hub / github.com/Effect-TS/effect / renderTextError

Function renderTextError

packages/effect/src/cli/Prompt.ts:3794–3814  ·  view source on GitHub ↗
(
  nextState: TextState,
  pointer: string,
  theme: Theme,
  renderOptions?: RenderOptions | undefined
)

Source from the content-addressed store, hash-verified

3792}
3793
3794const renderTextError = (
3795 nextState: TextState,
3796 pointer: string,
3797 theme: Theme,
3798 renderOptions?: RenderOptions | undefined
3799): string => {
3800 if (Option.isSome(nextState.error)) {
3801 return Arr.match(nextState.error.value.split(NEWLINE_REGEXP), {
3802 onEmpty: () => "",
3803 onNonEmpty: (errorLines) => {
3804 if (renderOptions?.plain === true) {
3805 return separateSymbol(pointer, errorLines.join("\n"))
3806 }
3807 const prefix = annotateSymbol(theme, pointer, theme.errorColor)
3808 const lines = Arr.map(errorLines, (str) => annotateErrorLine(theme, str))
3809 return Ansi.cursorSavePosition + "\n" + separateSymbol(prefix, lines.join("\n")) + Ansi.cursorRestorePosition
3810 }
3811 })
3812 }
3813 return ""
3814}
3815
3816const renderTextOutput = (
3817 nextState: TextState,

Callers 1

Prompt.tsFile · 0.85

Calls 6

separateSymbolFunction · 0.85
annotateSymbolFunction · 0.85
annotateErrorLineFunction · 0.85
splitMethod · 0.45
joinMethod · 0.45
mapMethod · 0.45

Tested by

no test coverage detected