Advertisement
Guest User

Untitled

a guest
Oct 25th, 2014
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. return new RSVP.Promise(function(Resolve, Reject) {
  2. if (!Obj.ID) {
  3. Reject('Invalid ID');
  4. } else {
  5. DB.Bucket.insert(Obj.ID, Obj, function(E, Result) {
  6. if (E) {
  7. if (E.code == 12) {
  8.  
  9. /* The specified ID is already being used */
  10. /* This is where I need to start a "retry" with a new ID */
  11.  
  12. } else {
  13. Reject(E); // Error Writing
  14. }
  15. } else {
  16. Resolve(Obj); // Successful Write
  17. }
  18. });
  19. }
  20. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement