mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-09-06 08:01:35 +00:00
* feat: ai flow chat * youpi * feat: preprocessor and error handler support * fix: reactivity * feat: inline script editor cmd l * nit * fix: apply in script editor * fixes * prompt nits
18 lines
339 B
TypeScript
18 lines
339 B
TypeScript
import { z } from 'zod'
|
|
|
|
const errorSchema = z.object({
|
|
error: z.any()
|
|
})
|
|
export function getStringError(result: unknown): string | undefined {
|
|
try {
|
|
const parsed = errorSchema.parse(result)
|
|
if (parsed.error) {
|
|
return JSON.stringify(parsed.error, null, 2)
|
|
} else {
|
|
return undefined
|
|
}
|
|
} catch (_) {
|
|
return undefined
|
|
}
|
|
}
|