mirror of
https://github.com/invoke-ai/InvokeAI.git
synced 2026-04-23 03:00:31 -04:00
feat(ui): add util to extract message from a tsafe AssertionError
This commit is contained in:
@@ -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;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user