File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed
Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -66,7 +66,22 @@ var pool = sync.Pool{
6666}
6767
6868// FormatDartStandalone formats a script without dependencies on external commands
69- func FormatDartStandalone (script string ) (string , error ) {
69+ func FormatDartStandalone (script string ) (result string , err error ) {
70+ defer func () {
71+ e := recover ()
72+
73+ if e == nil {
74+ return
75+ }
76+
77+ if e , ok := e .(error ); ok {
78+ err = e
79+ return
80+ }
81+
82+ err = fmt .Errorf ("%v" , e )
83+ }()
84+
7085 vm := pool .Get ().(* goja.Runtime )
7186 defer pool .Put (vm )
7287
@@ -77,7 +92,7 @@ func FormatDartStandalone(script string) (string, error) {
7792 }
7893
7994 var fn func (string ) string
80- err : = vm .ExportTo (dartFormat , & fn )
95+ err = vm .ExportTo (dartFormat , & fn )
8196 if err != nil {
8297 return "" , fmt .Errorf ("failed to execute dart_style formatter: %w" , err )
8398 }
You can’t perform that action at this time.
0 commit comments