Skip to content

Commit

Permalink
Removed onError (already deprecated)
Browse files Browse the repository at this point in the history
  • Loading branch information
leo committed Feb 4, 2017
1 parent 2429537 commit 5d1befa
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions lib/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ const isStream = require('isstream')
const DEV = 'development' === process.env.NODE_ENV
const TESTING = 'test' === process.env.NODE_ENV

const serve = fn => server((req, res) => {
run(req, res, fn, sendError)
})

module.exports = exports = serve

exports.run = run
Expand All @@ -17,16 +21,6 @@ exports.send = send
exports.sendError = sendError
exports.createError = createError

function serve(fn, {onError = null} = {}) {
if (onError) {
console.warn('[DEPRECATED] onError is deprecated and will be removed in a future release. Please use your own try/catch as needed.')
}

return server((req, res) => {
run(req, res, fn, onError || sendError)
})
}

async function run(req, res, fn, onError) {
try {
const val = await fn(req, res)
Expand Down

0 comments on commit 5d1befa

Please sign in to comment.