File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -23,9 +23,16 @@ module.exports = function (options = {}) {
23
23
}
24
24
25
25
return function ( error , req , res , next ) {
26
+ // Set the error code for HTTP processing semantics
27
+ error . code = ! isNaN ( parseInt ( error . code , 10 ) ) ? parseInt ( error . code , 10 ) : 500 ;
28
+
26
29
// Log the error if it didn't come from a service method call
27
30
if ( options . logger && typeof options . logger . error === 'function' && ! res . hook ) {
28
- options . logger . error ( error ) ;
31
+ if ( error . code >= 500 ) {
32
+ options . logger . error ( error ) ;
33
+ } else {
34
+ options . logger . info ( error ) ;
35
+ }
29
36
}
30
37
31
38
if ( error . type !== 'FeathersError' ) {
@@ -39,7 +46,6 @@ module.exports = function (options = {}) {
39
46
}
40
47
}
41
48
42
- error . code = ! isNaN ( parseInt ( error . code , 10 ) ) ? parseInt ( error . code , 10 ) : 500 ;
43
49
const formatter = { } ;
44
50
45
51
// If the developer passed a custom function for ALL html errors
You can’t perform that action at this time.
0 commit comments