2016-08-27 13 views
1

캐치되지 않은 예외 및 거부를 처리하기 위해 Rollbar을 사용하고 있습니다.Rollbar & Bluebird를 사용하여 캐치되지 않은 예외를 처리 할 때 유용한 정보 얻기

StatusCodeError: 503 - {"message":"Service Unavailable","error":503} 
at new StatusCodeError (/opt/example/app/node_modules/@request/promise-core/lib/errors.js line 32 col 15) 
Error.captureStackTrace(this); 
at Request.plumbing.callback (/opt/example/app/node_modules/@request/promise-core/lib/plumbing.js line 95 col 33) 
self._rp_reject(new errors.StatusCodeError(response.statusCode, body, self._rp_options, response)); 
at Request.RP$callback [as _callback] (/opt/example/app/node_modules/@request/promise-core/lib/plumbing.js line 37 col 31) 
plumbing.callback.call(self, err, response, body); 
at Request.self.callback (/opt/example/app/node_modules/request/request.js line 187 col 22) 
self._callback.apply(self, arguments) 
at emitTwo (events.js line 106 col 13) 
at Request.emit (events.js line 191 col 7) 
at Request.<anonymous> (/opt/example/app/node_modules/request/request.js line 1044 col 10) 
self.emit('complete', response, response.body) 
at emitOne (events.js line 96 col 13) 
at Request.emit (events.js line 188 col 7) 
at IncomingMessage.<anonymous> (/opt/example/app/node_modules/request/request.js line 965 col 12) 
self.emit('end', chunk) 
at emitNone (events.js line 91 col 20) 
at IncomingMessage.emit (events.js line 185 col 7) 
at endReadableNT (_stream_readable.js line 934 col 12) 
at _combinedTickCallback (internal/process/next_tick.js line 74 col 11) 
at process._tickDomainCallback (internal/process/next_tick.js line 122 col 9) 

을 그리고 여기에 bluebird 예제 : rollbar.handleUncaughtExceptionsAndRejections("...")

오류가 약속 안에 는 로그가 여기 request-promise의 예입니다, 전혀 유용하지 않다

TypeError: Cannot read property 'data' of undefined 
at String.eval (eval at <anonymous> (/opt/example/app/node_modules/bluebird/js/release/call_get.js:36:12), <anonymous> line 5 col 19) 
at String.tryCatcher (/opt/example/app/node_modules/bluebird/js/release/util.js line 16 col 23) 
return target.apply(this, arguments); 
at Promise._settlePromiseFromHandler (/opt/example/app/node_modules/bluebird/js/release/promise.js line 504 col 31) 
x = tryCatch(handler).call(receiver, value); 
at Promise._settlePromise (/opt/example/app/node_modules/bluebird/js/release/promise.js line 561 col 18) 
this._settlePromiseFromHandler(handler, receiver, value, promise); 
at Promise._settlePromise0 (/opt/example/app/node_modules/bluebird/js/release/promise.js line 606 col 10) 
this._settlePromise(promise, handler, receiver, value); 
at Promise._settlePromises (/opt/example/app/node_modules/bluebird/js/release/promise.js line 685 col 18) 
this._settlePromise0(this._fulfillmentHandler0, value, bitField); 
at Async._drainQueue (/opt/example/app/node_modules/bluebird/js/release/async.js line 138 col 16) 
fn._settlePromises(); 
at Async._drainQueues (/opt/example/app/node_modules/bluebird/js/release/async.js line 148 col 10) 
this._drainQueue(this._normalQueue); 
at Immediate.Async.drainQueues (/opt/example/app/node_modules/bluebird/js/release/async.js line 17 col 14) 
self._drainQueues(); 
at runCallback (timers.js line 570 col 20) 
at tryOnImmediate (timers.js line 550 col 5) 
at processImmediate [as _immediateCallback] (timers.js line 529 col 5) 

무엇을 할 수 실제 오류 위치를 기록합니까?

+0

스택 추적에 Bluebird가 표시되지 않습니까? 블루 버드 약속이라고 확신합니까? – Bergi

+0

사실이 예제는 request-promise를 사용합니다. 여러분이 맞습니다. –

+0

@Bergi는 bluebird 예제를 추가했습니다. –

답변

0

는 Blueibird로 전체 스택 추적을 얻을 거부를 처리되지 않은 사용 : 그것은 작은 속도 저하를 초래하지 않지만

Promise.config({ longStackTraces: true }); 

당신에게 더 많은 정보를 오류를 제공해야한다.