secondmarket/mongeez — pull request #35 by dtserekhman (2013-11-21 01:44:26+00:00)
Title: Mongeez fail-fast behavior

+ As per Google Groups discussion with "davidmc24" (see below), introduced MongeezException and started throwing it instead of logger.error(..) logging for fail-fast behavior. There was also at least one usage of logger.warn(..) that I replaced with MongeezException. Also, I simplified and used "catch-all" Exception to re-throw it as MongeezException.

-----------------------------
davidmc24

"I think that it may have been me that introduced this behavior. My main goal at the time was for the output to be consistently logged, rather than go to System.out/err. I'd be fine with petty much all scenarios failing fast (no config option needed). Maybe introduce a MongeezException class and throw that in the catch blocks?"
—
Sent from Mailbox for iPhone

On Tue, Nov 19, 2013 at 6:18 PM, Dmitriy Tserehman wrote:

- show quoted text -
- show quoted text -
Was there a thought of either re-throwing exception after logging it or just throwing some Unchecked or other RuntimeException? May be such behavior could be also made conditional, similarly to how it is done with the "failOnError" flag on the ChangeSet?

} catch (RuntimeException e) {
if (changeSet.isFailOnError()) {
throw e;
} else {
logger.warn("ChangeSet " + changeSet.getChangeId() + " has failed, but failOnError is set to false", e.getMessage());
}
}

Thanks,
Dmitriy.