Skip to content

Commit cb6f9ac

Browse files
fix: update Koa2 plugin to await next (#339)
PR #336 fixed the Koa plugin, but didn't fix the Koa2 plugin. Fixes: #335
1 parent db8136d commit cb6f9ac

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ export class ErrorReporting {
120120
// tslint:disable-next-line:no-any
121121
koa!: (context: any, next: {}) => IterableIterator<{}>;
122122
// tslint:disable-next-line:no-any
123-
koa2!: (context: any, next: {}) => Promise<void>;
123+
koa2!: (context: any, next: Function) => Promise<void>;
124124

125125
constructor(initConfiguration?: ConfigurationOptions) {
126126
if (!(this instanceof ErrorReporting)) {

src/interfaces/koa2.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import {koaRequestInformationExtractor} from '../request-extractors/koa';
2525
type KoaContext = {
2626
request: Request; response: Response
2727
};
28-
type KoaNext = {};
28+
type KoaNext = Function;
2929

3030
/**
3131
* The koaErrorHandler should be placed at the beginning of the koa middleware
@@ -54,7 +54,7 @@ export function koa2ErrorHandler(
5454
const svc = config.getServiceContext();
5555

5656
try {
57-
await next;
57+
await next();
5858
} catch (err) {
5959
const em = new ErrorMessage()
6060
.consumeRequestInformation(koaRequestInformationExtractor(

0 commit comments

Comments
 (0)