From 5e0fbdbe1a012383d613562d667c8cd79686d003 Mon Sep 17 00:00:00 2001 From: jin Date: Tue, 21 Nov 2023 20:57:48 +0300 Subject: [PATCH] $mol_dev_format: error proof --- dev/format/format.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dev/format/format.ts b/dev/format/format.ts index c0bd246b080..07c15632518 100644 --- a/dev/format/format.ts +++ b/dev/format/format.ts @@ -26,13 +26,17 @@ namespace $ { if( !val ) return null if( $mol_dev_format_head in val ) { - return val[ $mol_dev_format_head ]() + try { + return val[ $mol_dev_format_head ]() + } catch( error ) { + return $mol_dev_format_accent( $mol_dev_format_native( val ), '💨', $mol_dev_format_native( error ), '' ) + } } if( typeof val === 'function' ) { return $mol_dev_format_native( val ) } - + return null } ,