natergj / excel4node

Node module to allow for easy Excel file creation
MIT License
1.38k stars 215 forks source link

handling exceptions for error wb.write() #347

Open Fayris-develop opened 3 years ago

Fayris-develop commented 3 years ago

Good afternoon. Is there some way to catch errors when writing is not possible?

I'll tell you right away that I'm a beginner. For some time I could not understand why my program crashes, and then I realized that I had an output file open. Is it possible to somehow prevent the program from crashing and let the user know about it?

This construction doesn't work:

try { wb.write('Result.xlsx'); } catch (ex) {
console.log("Close result file"); }

Environment (please complete the following information):