Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | 28x 28x 1426x 2x 1424x 4x 1420x 1x 28x 1419x 1x 1418x 2x 1416x 1x | const ModernError = require('./errors');
exports.middleware = middle => {
if (!middle) {
throw new ModernError('missingmiddleware');
}
if (!(middle instanceof Function)) {
throw new ModernError('invalidmiddleware', { type: typeof middle });
}
if (middle.length === 4) {
throw new ModernError('errormiddleware');
}
};
exports.context = ctx => {
if (!ctx) {
throw new ModernError('missingcontext');
}
if (!ctx.req) {
throw new ModernError('malformedcontext', { item: 'res' });
}
if (!ctx.res) {
throw new ModernError('malformedcontext', { item: 'res' });
}
};
|