1 import logger from
'./Logger';
3 export default class FileUtils
{
4 static handleFileException(logPrefix
: string, fileType
: string, filePath
: string, error
: NodeJS
.ErrnoException
, consoleOut
= false): void {
5 const prefix
= logPrefix
.length
!== 0 ? logPrefix
+ ' ' : '';
6 if (error
.code
=== 'ENOENT') {
8 console
.warn(prefix
+ fileType
+ ' file ' + filePath
+ ' not found: ', error
);
10 logger
.warn(prefix
+ fileType
+ ' file ' + filePath
+ ' not found: %j', error
);
14 console
.error(prefix
+ fileType
+ ' file ' + filePath
+ ' opening error: ', error
);
16 logger
.error(prefix
+ fileType
+ ' file ' + filePath
+ ' opening error: %j', error
);