♻️ Export bot-engine code into its own package
This commit is contained in:
11
packages/bot-engine/logs/helpers/formatLogDetails.ts
Normal file
11
packages/bot-engine/logs/helpers/formatLogDetails.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { isNotDefined } from '@typebot.io/lib/utils'
|
||||
|
||||
export const formatLogDetails = (details: unknown): string | null => {
|
||||
if (isNotDefined(details)) return null
|
||||
if (details instanceof Error) return details.toString()
|
||||
try {
|
||||
return JSON.stringify(details, null, 2).substring(0, 1000)
|
||||
} catch {
|
||||
return null
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user