truffle icon indicating copy to clipboard operation
truffle copied to clipboard

Caught errors in deployment may still cause overall error

Open haltman-at opened this issue 3 years ago • 1 comments

Issue

When an error occurs during deployment, even if the error is caught, it may still go on to cause the overall deployment to error (as in, await deployer.start() will throw; in a migration, an error message will be printed).

For a repro example, one may use the same example as in #3066.

The obvious culprit is the line self._error(e) in this file. However, removing this line causes test failures. (Note that #5216 added throw e but did not remove self._error(e) and so did not fix this issue.)

Hopefully it is possible to fix this without a breaking change (see #5223, #3867); whether or not it is will remain to be seen. I think it's worth a try though, I'm hopeful about this one.

Environment

  • Truffle version (truffle version): 5.5.18

haltman-at avatar Jun 23 '22 17:06 haltman-at

OK, it turns out I don't know how to fix this after all. I thought I could fix this by removing the line self._error(e) from DeferredChain.prototype.then (which actually allows one to delete that whole catch as unnecessary) and instead adding a .catch(this._error) in DeferredChain.prototype.start (line 42; actually I used a a second argument to then, rather than a catch, but you get the idea). For whatever reason, this caused all sorts of hangs. I dunno. I guess I have no clue how to solve this after all!

haltman-at avatar Jul 08 '22 00:07 haltman-at