* One-line summary of a smol-toml parse error: first message line plus the * line/column location, without the multi-line code-frame block.
(error: unknown)
| 255 | * line/column location, without the multi-line code-frame block. |
| 256 | */ |
| 257 | function describeTomlSyntaxError(error: unknown): string { |
| 258 | const firstLine = describeUnknownError(error).split('\n', 1)[0] ?? ''; |
| 259 | if (error instanceof TomlError) { |
| 260 | return `${firstLine} (line ${error.line}, column ${error.column})`; |
| 261 | } |
| 262 | return firstLine; |
| 263 | } |
| 264 | |
| 265 | export function parseConfigString(tomlText: string, filePath = 'config.toml'): KimiConfig { |
| 266 | if (tomlText.trim().length === 0) { |
no test coverage detected