Skip to content

Commit

Permalink
use fixed ident
Browse files Browse the repository at this point in the history
  • Loading branch information
WMXPY committed Oct 16, 2023
1 parent 9aca082 commit 6d70263
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/**
* @author WMXPY
* @namespace Error_Record_Enrich
* @description Procedure Identifier Not Found During Enrich
*/

import { PubRecordEnrichError } from "./enrich-error";

export class PubRecordEnrichProcedureIdentifierNotFoundDuringEnrichError extends PubRecordEnrichError {

public static create(
identifier: string,
): PubRecordEnrichProcedureIdentifierNotFoundDuringEnrichError {

return new PubRecordEnrichProcedureIdentifierNotFoundDuringEnrichError(
`Enrich procedure identifier not found during enrich due to: ${identifier}`,
);
}

protected constructor(
message: string,
reason?: any,
) {

super(message, "PubRecordEnrichProcedureIdentifierNotFoundDuringEnrichError", reason);

Object.setPrototypeOf(this, PubRecordEnrichProcedureIdentifierNotFoundDuringEnrichError.prototype);
}
}
14 changes: 11 additions & 3 deletions src/record/enrich/init-connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import { PubConnectionConfiguration } from "../../connection/definition/configuration";
import { generateIdentifier } from "../../util/identifier";
import { PubRecordEnrichProcedureIdentifierNotFoundDuringEnrichError } from "../../error/record/enrich/procedure-identifier-not-found-during-enrich";
import { PubRecordConnectionEnrich, PubRecordConnectionEnrichMap } from "../definition/connection-enrich";
import { PubRecordProcedureEnrich, PubRecordProcedureEnrichMap } from "../definition/procedure-enrich";

Expand Down Expand Up @@ -34,14 +34,22 @@ export const recordInitEnrichConnection = (
const triggerEnrich: PubRecordProcedureEnrich<any> | undefined =
enrichProcedureMap.get(connection.triggerProcedureIdentifier);

if (!triggerEnrich) {
throw PubRecordEnrichProcedureIdentifierNotFoundDuringEnrichError.create(connection.triggerProcedureIdentifier);
}

const nextEnrich: PubRecordProcedureEnrich<any> | undefined =
enrichProcedureMap.get(connection.nextProcedureIdentifier);

if (!nextEnrich) {
throw PubRecordEnrichProcedureIdentifierNotFoundDuringEnrichError.create(connection.nextProcedureIdentifier);
}

return {

connectionIdentifier: connection.identifier,

triggerWaypoint: triggerEnrich ? triggerEnrich.exitWaypoint : generateIdentifier(),
nextWaypoint: nextEnrich ? nextEnrich.enterWaypoint : generateIdentifier(),
triggerWaypoint: triggerEnrich.enterWaypoint,
nextWaypoint: nextEnrich.enterWaypoint,
};
};

0 comments on commit 6d70263

Please sign in to comment.