Skip to content

Commit

Permalink
fix: err is undefined (#131)
Browse files Browse the repository at this point in the history
  • Loading branch information
snadn authored and niftylettuce committed Dec 23, 2019
1 parent 85a6ae6 commit f585464
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ module.exports = function(options = {}) {
if (err.code === 'ENOENT') {
debug('get session error, code = ENOENT')
} else {
debug('get session error: ', err.message)
debug('get session error: ', err && err.message)
errorHandler(err, 'get', ctx)
}
}
Expand Down Expand Up @@ -287,7 +287,7 @@ module.exports = function(options = {}) {
sessionIdStore.set.call(ctx, id, session)
debug('saved')
} catch (err) {
debug('set session error: ', err.message)
debug('set session error: ', err && err.message)
errorHandler(err, 'set', ctx)
}
}
Expand Down Expand Up @@ -345,14 +345,14 @@ module.exports = function(options = {}) {
try {
await next()
} catch (err) {
debug('next logic error: %s', err.message)
debug('next logic error: %s', err && err.message)
firstError = err
}
// can't use finally because `refreshSession` is async
try {
await refreshSession(ctx, ctx.session, result.originalHash, result.isNew)
} catch (err) {
debug('refresh session error: %s', err.message)
debug('refresh session error: %s', err && err.message)
if (firstError) ctx.app.emit('error', err, ctx)
firstError = firstError || err
}
Expand Down

0 comments on commit f585464

Please sign in to comment.