mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-18 16:02:10 +00:00
improve handling of unexpected toast errors
This commit is contained in:
@@ -2,7 +2,11 @@
|
||||
const pathRegex = /\b(u|f)\/[^\/\s]+\/[^\/\s]+\b/g
|
||||
|
||||
export function processMessage(message: string | undefined): string {
|
||||
return (message ?? 'Error without message').replaceAll(pathRegex, (path) => {
|
||||
return (
|
||||
typeof message == 'string'
|
||||
? message ?? 'Error without message'
|
||||
: JSON.stringify(message, null, 2)
|
||||
).replaceAll(pathRegex, (path) => {
|
||||
return `<span class="bg-surface-secondary p-1 text-xs font-mono whitespace-nowrap rounded-md">${path}</span>`
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user