mirror of
https://github.com/invoke-ai/InvokeAI
synced 2026-05-01 03:02:21 +02:00
feat(ui): add util to extract message from a tsafe AssertionError
This commit is contained in:
parent
6c59790a7f
commit
730fabe2de
@ -0,0 +1,6 @@
|
||||
import type { AssertionError } from 'tsafe';
|
||||
|
||||
export function extractMessageFromAssertionError(error: AssertionError): string | null {
|
||||
const match = error.message.match(/Wrong assertion encountered: "(.*)"/);
|
||||
return match ? (match[1] ?? null) : null;
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user