Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New hook: afterRemoteError #189

Closed
3 tasks done
bajtos opened this issue Mar 31, 2015 · 3 comments
Closed
3 tasks done

New hook: afterRemoteError #189

bajtos opened this issue Mar 31, 2015 · 3 comments
Assignees
Labels

Comments

@bajtos
Copy link
Member

bajtos commented Mar 31, 2015

Consider the use case described in loopbackio/loopback-datasource-juggler#545

  1. in beforeRemote('create', ...) uploaded files (multipart/form-data) are handled
  2. this adds the stored filename/path to ctx.args.data so the model will save this
  3. however, the model appears to be invalid for some reason (unrelated to the uploaded file)
  4. now, validation fails and there's no way to purge the now orphaned uploaded file from storage/disk

We should add a new hook triggered whenever a remote request fails, so that users can clean up any resources allocated in "beforeRemote" hook.

Tasks

@ritch
Copy link
Member

ritch commented Mar 31, 2015

Good idea...

@bajtos
Copy link
Member Author

bajtos commented Apr 1, 2015

See #190 for the strong-remoting part. I need to implement Model.afterRemoteError in loopback once #190 is landed.

@bajtos
Copy link
Member Author

bajtos commented Apr 8, 2015

I have updated the documentation page http://docs.strongloop.com/display/LB/Remote+hooks and described the new afterRemoteError hook. @crandmck please review the page and edit as you like.

I am closing this issue as resolved.

@bajtos bajtos closed this as completed Apr 8, 2015
@bajtos bajtos removed the #wip label Apr 8, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants