Skip to content

Commit

Permalink
Fix default logger and remove logging the whole error in some cases
Browse files Browse the repository at this point in the history
  • Loading branch information
GiladShoham committed Feb 21, 2017
1 parent dd0fdc0 commit a2f73af
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import minilog from 'minilog';
const log = minilog('grpahql-apollo-error');
var log = require('minilog')('grpahql-apollo-error');
require('minilog').enable();
import _ from 'lodash';
import uuid from 'uuid';
import SevenBoom from 'seven-boom';
Expand Down Expand Up @@ -63,14 +63,14 @@ export const formatErrorGenerator = (formatErrorOptions) => {


if (err === undefined || !err.isBoom) {
logger.info('Transform error to boom error');
logger.log('Transform error to boom error');
if (err === undefined) {
err = new Error(originalError);
} else {
err = new Error(err);
}

logger.info('originalError message was : ', err.message);
logger.log('originalError message was : ', err.message);
err = SevenBoom.wrap(err, 500);
}

Expand All @@ -82,11 +82,11 @@ export const formatErrorGenerator = (formatErrorOptions) => {
err.output.payload.path = originalError.path;
}

// Special implemantation for internal server errors
if (err.isServer) {
// Special implemantation for internal server errors
logger.error(err);
// logger.error(err);
} else {
logger.debug(err);
// logger.debug(err);
}

if (onProcessedError && _.isFunction(onProcessedError)){
Expand Down

0 comments on commit a2f73af

Please sign in to comment.