Fixed delegating errors to callbacks

In few places, after callback was called with error, the function was running further, causing unexpedted actions.

Please check line 563. Although the function’s name is `resolveIfNoError`, the error is handled and there is no `return` after promise rejection. I'm not sure if it should be ther or not, so I leave it to you.