File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -20,8 +20,8 @@ const Accessibility = (on, config) => {
2020 readFileIfExists ( filePath ) {
2121 const fullPath = path . resolve ( filePath ) ;
2222 if ( fs . existsSync ( fullPath ) ) {
23- const content = fs . readFileSync ( fullPath , 'utf8' ) ;
24- return { exists : true , content } ;
23+ const fileContent = fs . readFileSync ( fullPath , 'utf8' ) ;
24+ return { exists : true , content : fileContent } ;
2525 } else {
2626 return { exists : false , content : null } ; // Return null if the file doesn't exist
2727 }
Original file line number Diff line number Diff line change @@ -99,11 +99,11 @@ function processAccessibilityReport(win){
9999 let resultsArray = [ { } ] ;
100100 console . log ( 'logging report' , res ) ;
101101 // If the file is not empty, parse the existing content
102- if ( result . exists && result . fileContent ) {
102+ if ( result . exists && result . content ) {
103103 try {
104- resultsArray = JSON . parse ( JSON . stringify ( result . fileContent ) ) ;
104+ resultsArray = JSON . parse ( JSON . stringify ( result . content ) ) ;
105105 } catch ( e ) {
106- console . log ( "parsing error for content " , result . fileContent )
106+ console . log ( "parsing error for content " , result . content )
107107 console . log ( 'Error parsing JSON file:' , e ) ;
108108 return ;
109109 }
@@ -115,9 +115,13 @@ function processAccessibilityReport(win){
115115 }
116116
117117 if ( res && res . message == "GET_LATEST_SCAN_DATA" ) {
118+ try {
118119 // Append the new result
119120 resultsArray . push ( res ) ;
120121 console . log ( 'resultsarray logging' , resultsArray ) ;
122+ } catch ( e ) {
123+ console . log ( 'Error pushing issues to array:' , e ) ;
124+ }
121125 }
122126
123127 // Write the updated content back to the file
You can’t perform that action at this time.
0 commit comments