Skip to content

Commit

Permalink
Merge pull request #420 from senacor/feature/remove_check_for_empty_r…
Browse files Browse the repository at this point in the history
…esult

Remove check for empty result
  • Loading branch information
ziegler-daniel authored Sep 5, 2024
2 parents 6a29787 + 933cb68 commit 52b1840
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# CHANGELOG

## 3.0.3 (05.09.2024)
- Remove check for empty result

## 3.0.2 (22.08.2024)
- Disable Application Insights internal debug logging

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@senacor/azure-function-middleware",
"version": "3.0.2",
"version": "3.0.3",
"description": "Middleware for azure functions to handle authentication, authorization, error handling and logging",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
6 changes: 1 addition & 5 deletions src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const middlewareCore =
handler: T,
postExecution: (PostExecutionFunction<T> | false)[],
) =>
async (request: Parameters<T>, context: InvocationContext): Promise<ReturnType<T> | Error> => {
async (request: Parameters<T>, context: InvocationContext): Promise<ReturnType<T> | undefined | Error> => {
let handlerResult: MiddlewareResult<ReturnType<T>> = { $failed: false, $result: undefined };

if (beforeExecution) {
Expand Down Expand Up @@ -65,10 +65,6 @@ const middlewareCore =
return handlerResult.$error;
}

if (handlerResult.$result === undefined) {
return new Error('Illegal-State: Result of the handler was empty.');
}

return handlerResult.$result;
};

Expand Down

0 comments on commit 52b1840

Please sign in to comment.