Skip to content

Commit

Permalink
Merge pull request #157 from sliit-foss/feat/fallible-async-handler
Browse files Browse the repository at this point in the history
Patch(functions): updated type declarations
  • Loading branch information
Akalanka47000 authored Mar 9, 2024
2 parents 21f7b31 + dff0979 commit a7c5fd7
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion packages/functions/types/async.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,21 @@ export function asyncHandler(fn: Function): (req: any, res: any, next: Function)
*/
export function tracedAsyncHandler(fn: Function): (req: any, res: any, next: Function) => Promise<void>;

/**
* @description Same as the `tracedAsyncHandler` but the log upon failure is a warning log
* @param fn The function to be invoked asynchronously
*/
export function fallibleAsyncHandler(fn: Function): (req: any, res: any, next: Function) => Promise<void>;

/**
* @description A more stripped down version of asyncHandler without any logs
* @param fn The function to be invoked asynchronously
*/
export function plainAsyncHandler(fn: Function): (req: any, res: any, next: Function) => Promise<void>;

export default {
asyncHandler,
tracedAsyncHandler
tracedAsyncHandler,
fallibleAsyncHandler,
plainAsyncHandler
};

0 comments on commit a7c5fd7

Please sign in to comment.