Skip to content

Commit 9197b78

Browse files
committed
Add new option to config allow-filter-errors.
1 parent f0b29ea commit 9197b78

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

changes.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
- added: `GROUP(flags, fn)` alias for `F.group()`
3333
- added: `F.cache.set2()` it creates a persistent cache (persistent items are stored in a file)
3434
- added: new View Engine command `@{'%config'}` which reads a value from config directly
35+
- added: `F.config['allow-filter-errors']` for filtering network unhandled errors
3536

3637
- updated: (IMPORTANT) packages compress/decompress function supports streaming data
3738
- updated: (IMPORTANT) `NOSQL().backup()` !!! was changed !!!!

index.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -597,6 +597,7 @@ function Framework() {
597597
'allow-defer': false,
598598
'allow-debug': false,
599599
'allow-head': false,
600+
'allow-filter-errors': true,
600601
'disable-strict-server-certificate-validation': true,
601602
'disable-clear-temporary-directory': false,
602603

@@ -15177,13 +15178,16 @@ global.Controller = Controller;
1517715178

1517815179
process.on('uncaughtException', function(e) {
1517915180

15180-
if (e.toString().indexOf('listen EADDRINUSE') !== -1) {
15181+
var err = e.toString();
15182+
15183+
if (err.indexOf('listen EADDRINUSE') !== -1) {
1518115184
if (typeof(process.send) === 'function')
1518215185
process.send('eaddrinuse');
1518315186
console.log('\nThe IP address and the PORT is already in use.\nYou must change the PORT\'s number or IP address.\n');
1518415187
process.exit('SIGTERM');
1518515188
return;
15186-
}
15189+
} else if (F.config['allow-filter-errors'] && err.lastIndexOf('EPIPE') !== -1)
15190+
return;
1518715191

1518815192
F.error(e, '', null);
1518915193
});

0 commit comments

Comments
 (0)