Skip to content

Commit

Permalink
Gracefully handle errors (AppiumTestDistribution#1139)
Browse files Browse the repository at this point in the history
  • Loading branch information
sudharsan-selvaraj committed May 30, 2024
1 parent 22c7ecf commit dd61482
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ appium-e2e-test
temp-appium
.env
src/public/*
docs/reference
docs/reference
.npmrc
2 changes: 1 addition & 1 deletion src/modules
7 changes: 6 additions & 1 deletion src/proxy/wd-command-proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,12 @@ export function wrapRequestWithMiddleware(options: {
for (const middlware of middlewares) {
next = ((_next) => async () => {
if (_.isFunction(middlware)) {
return await middlware(request, response, _next);
try {
return middlware(request, response, _next);
} catch (e) {
log.error('Error executing middleware:');
log.error(e);
}
}
})(next);
}
Expand Down

0 comments on commit dd61482

Please sign in to comment.