Add a fail fast mechanism instead of rejecting the whole process on error.

This prevent clobbering registry and cache, since when the promise is rejected usually process.exit(1) is called.
Print only the stack trace when verbose or the error has no code (usually something strange).
Reduce nesting and fix analyse not restoring dependants properly in some cases.