aldrin312 / AutoCommentingTool

BSD 3-Clause "New" or "Revised" License
2 stars 2 forks source link

Using async for writeFile #4

Closed fadingNA closed 1 month ago

fadingNA commented 1 month ago

https://github.com/aldrin312/AutoCommentingTool/blob/0a92be444b052f54d79ada889570c9e01a54b887/index.js#L47

using asynchonous to dealing with file even read or load, better because you can use async with error handling, easier for debug and not crash the application

aldrin312 commented 1 month ago

Fixed! asynced the writeIntoFile function.

fadingNA commented 1 month ago

@aldrin312 You may wan to


try{
  // processing file 

  return . 
}catch(err)
 console.error(`Error from write file ${err} ...`
 return .. 

you might wrap it with try catch block better for debug