Skip to content

Instantly share code, notes, and snippets.

@frankshaka
Last active September 11, 2017 05:07
Show Gist options
  • Save frankshaka/5c2c5cc62332302e72f4aa57bae12883 to your computer and use it in GitHub Desktop.
Save frankshaka/5c2c5cc62332302e72f4aa57bae12883 to your computer and use it in GitHub Desktop.
Unmount paths even on error for koa-mount
58c58,68
< await downstream(ctx, async () => {
---
> try {
> await downstream(ctx, async () => {
> ctx.path = prev;
> try {
> await upstream();
> } finally {
> ctx.path = newPath;
> }
> });
> } finally {
> debug('leave %s -> %s', prev, ctx.path);
60,65c70
< await upstream();
< ctx.path = newPath;
< });
<
< debug('leave %s -> %s', prev, ctx.path);
< ctx.path = prev;
---
> }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment