Skip to content

Commit

Permalink
feat(server/promise-events): bail out when request struct is abnormal
Browse files Browse the repository at this point in the history
Promise event handler should only handle properly structured requests otherwise lets bail out early.
  • Loading branch information
TasoOneAsia committed Dec 3, 2021
1 parent eccf6be commit 5cb8ac6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions resources/server/lib/PromiseNetEvents/onNetPromise.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ export function onNetPromise<T = any, P = any>(eventName: string, cb: CBSignatur
const startTime = process.hrtime.bigint();
const src = getSource();

if (!respEventName) {
return netEventLogger.warn(
`Promise event (${eventName}) was called with wrong struct by ${src} (maybe originator wasn't a promiseEvent`,
);
}

const promiseRequest: PromiseRequest<T> = {
source: src,
data,
Expand Down

0 comments on commit 5cb8ac6

Please sign in to comment.