Skip to content

Commit

Permalink
🍺 fixed the return statement issue
Browse files Browse the repository at this point in the history
  • Loading branch information
vivek12345 committed Jan 31, 2019
1 parent 5b95c25 commit 723a62b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion transforms/async-await-with-try-catch.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ export default function transformer(file, api) {
(ExpressionTypes.indexOf(path.parent.node.type) >= 0 || path.parent.node.type === 'VariableDeclarator')
)
return;
replaceWithTryCatch(path, j.expressionStatement(path.node));
if (path.parent.node.type === 'ReturnStatement') {
replaceWithTryCatch(path.parent, path.parent.node);
} else {
replaceWithTryCatch(path, j.expressionStatement(path.node));
}
});
root.find(j.VariableDeclaration).forEach(path => {
const variableDeclarators = path.node.declarations;
Expand Down

0 comments on commit 723a62b

Please sign in to comment.