Skip to content

Commit

Permalink
fix: validate, flatten promise (fix missing propagation of errors) (f…
Browse files Browse the repository at this point in the history
  • Loading branch information
ajorkowski authored and foxhound87 committed Aug 25, 2017
1 parent 5a1b914 commit 361357e
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions src/Validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,21 +87,21 @@ export default class Validator {
related,
}));

// wait all promises then resolve
return Promise.all(this.promises)
.then(action(() => {
instance.$validating = false;
instance.$clearing = false;
instance.$resetting = false;
}))
.catch(action((err) => {
instance.$validating = false;
instance.$clearing = false;
instance.$resetting = false;
throw err;
}))
.then(() => resolve(instance));
});
// wait all promises
resolve(Promise.all(this.promises));
})
.then(action(() => {
instance.$validating = false;
instance.$clearing = false;
instance.$resetting = false;
}))
.catch(action((err) => {
instance.$validating = false;
instance.$clearing = false;
instance.$resetting = false;
throw err;
}))
.then(() => instance);
}

@action
Expand Down

0 comments on commit 361357e

Please sign in to comment.