Page 145 - Nodejs 교과서 개정2판
P. 145

...
           //	계속	반복




         ী۞ח ߊࢤೞ૑݅ try catch۽ ੟ਸ ࣻ ੓Ҋ setIntervalب ૒੽ ݥ୶ӝ ੹  $USM   $  ө૑ ҅ࣘ प೯ؾפ׮

         ੉ۧѱ ী۞о ߊࢤೡ Ѫ э਷ ࠗ࠙ਸ ޷ܻ try DBUDI۽ хऱݶ ؾפ׮

         ੉ߣীח ֢٘ ੗୓ীࢲ ੟ই઱ח ী۞ܳ ঌইࠁѷणפ׮

          error2.js

           const	fs	=	require('fs');


           setInterval(()	=>	{
           		fs.unlink('./abcdefg.js',	(err)	=>	{
           				if	(err)	{
           						console.error(err);
           				}
           		});
           },	1000);




         fs.unlink۽ ઓ੤ೞ૑ ঋח ౵ੌਸ ૑਋Ҋ ੓णפ׮  ী۞о ߊࢤೞ૑݅ ׮೯൤ ֢٘ ղ੢ ݽٕ੄ ী۞ח प೯
         ઺ੋ ೐۽ࣁझܳ ݥ୶૑ ঋणפ׮  ী۞ ۽Ӓܳ ӝ۾೧فҊ ա઺ী ਗੋਸ ଺ই ࣻ੿ೞݶ ؾפ׮


            ੺੄ ৘ઁীࢲח ী۞о ߊࢤ೮ਸ ٸ ী۞ܳ throw೮णפ׮  Ӓؘ۠ throwܳ ೞݶ ֢٘ ೐۽ࣁझо ݥ୾ߡ݀

         פ׮  ٮۄࢲ throwܳ ೞח ҃਋ীח ߈٘द try catchޙਵ۽ throwೠ ী۞ܳ ੟ইঠ ೤פ׮

          콘솔
           $	node	error2
           [Error:	ENOENT:	no	such	file	or	directory,	unlink	'C:\Users\zerocho\abcdefg.js']	{
           		errno:	-4058,
           		code:	'ENOENT',
           		syscall:	'unlink',
           		path:	'C:\\Users\\zerocho\\abcdefg.js'
           }
           [Error:	ENOENT:	no	such	file	or	directory,	unlink	'C:\Users\zerocho\abcdefg.js']	{
           		errno:	-4058,
           		code:	'ENOENT',
           		syscall:	'unlink',
           		path:	'C:\\Users\\zerocho\\abcdefg.js'
           }
           //	계속	반복
   140   141   142   143   144   145   146   147   148   149   150