fix(core): update

This commit is contained in:
2020-10-06 15:05:29 +00:00
parent 78e8171a6a
commit 046059d228
7 changed files with 39 additions and 29 deletions

View File

@ -28,7 +28,7 @@ export class TypedHandler<T extends plugins.typedRequestInterfaces.ITypedRequest
);
}
let typedResponseError: TypedResponseError;
const response = await this.handlerFunction(typedRequestArg.request).catch(e => {
const response = await this.handlerFunction(typedRequestArg.request).catch((e) => {
if (e instanceof TypedResponseError) {
typedResponseError = e;
} else {
@ -39,7 +39,7 @@ export class TypedHandler<T extends plugins.typedRequestInterfaces.ITypedRequest
if (typedResponseError) {
typedRequestArg.error = {
text: typedResponseError.errorText,
data: typedResponseError.errorData
data: typedResponseError.errorData,
};
}
@ -47,7 +47,7 @@ export class TypedHandler<T extends plugins.typedRequestInterfaces.ITypedRequest
typedRequestArg.response = response;
}
typedRequestArg?.correlation?.phase ? typedRequestArg.correlation.phase = 'response' : null;
typedRequestArg?.correlation?.phase ? (typedRequestArg.correlation.phase = 'response') : null;
return typedRequestArg;
}

View File

@ -29,15 +29,12 @@ export class TypedRequest<T extends plugins.typedRequestInterfaces.ITypedRequest
public method: string;
// STATIC
constructor(
postEndPointArg: string | IPostMethod,
methodArg: T['method']
)
constructor(postEndPointArg: string | IPostMethod, methodArg: T['method']);
constructor(
postEndPointArg: string | IPostMethodWithTypedRouter,
methodArg: T['method'],
typedrouterRefArg?: TypedRouter)
{
typedrouterRefArg?: TypedRouter
) {
if (typeof postEndPointArg === 'string') {
this.urlEndPoint = postEndPointArg;
} else {
@ -67,8 +64,8 @@ export class TypedRequest<T extends plugins.typedRequestInterfaces.ITypedRequest
responseBody = response;
} else {
let responseInterest: plugins.lik.Interest<
string,
plugins.typedRequestInterfaces.ITypedRequest
string,
plugins.typedRequestInterfaces.ITypedRequest
>;
// having a typedrouter allows us to work with async request response cycles.
if (this.typedRouterRef) {