@@ -477,7 +477,8 @@ export default class EditorFile {
477477
478478 await fs . writeFile ( text ) ;
479479 } catch ( error ) {
480- console . error ( error ) ;
480+ window . log ( "error" , "Writing to cache failed:" ) ;
481+ window . log ( "error" , error ) ;
481482 }
482483 }
483484
@@ -519,7 +520,7 @@ export default class EditorFile {
519520 if ( oldText . length !== text . length ) return true ;
520521 return oldText !== text ;
521522 } catch ( error ) {
522- console . log ( error ) ;
523+ window . log ( "error" , error ) ;
523524 return false ;
524525 }
525526 }
@@ -789,7 +790,8 @@ export default class EditorFile {
789790 if ( ! ( await fs . exists ( ) ) ) return ;
790791 fs . renameTo ( newId ) ;
791792 } catch ( error ) {
792- console . error ( "renameCacheFile" , error ) ;
793+ window . log ( "error" , "renameCacheFile" ) ;
794+ window . log ( "error" , error ) ;
793795 }
794796 }
795797
@@ -802,7 +804,7 @@ export default class EditorFile {
802804 if ( ! ( await fs . exists ( ) ) ) return ;
803805 await fs . delete ( ) ;
804806 } catch ( error ) {
805- console . error ( error ) ;
807+ window . log ( "error" , error ) ;
806808 }
807809 }
808810
@@ -838,6 +840,7 @@ export default class EditorFile {
838840 } else if ( ! cacheExists && fileExists ) {
839841 value = await file . readFile ( this . encoding ) ;
840842 } else if ( ! cacheExists && ! fileExists ) {
843+ window . log ( "error" , "unable to load file" ) ;
841844 throw new Error ( "Unable to load file" ) ;
842845 }
843846 }
@@ -870,7 +873,8 @@ export default class EditorFile {
870873 this . #emit( "loaderror" , createFileEvent ( this ) ) ;
871874 this . remove ( ) ;
872875 toast ( `Unable to load: ${ this . filename } ` ) ;
873- console . log ( error ) ;
876+ window . log ( "error" , "Unable to load: " + this . filename ) ;
877+ window . log ( "error" , error ) ;
874878 } finally {
875879 this . #emit( "loadend" , createFileEvent ( this ) ) ;
876880 }
0 commit comments