ic icon indicating copy to clipboard operation
ic copied to clipboard

refactor(orchestrator): [CON-1631] re-organize error types in the orchestrator

Open pierugo-dfinity opened this issue 9 months ago • 0 comments

As of today, UpgradeError and OrchestratorError are tightly coupled and some variants exist in both just to have a clean cast. Furthermore, a lot of OrchestratorErrors are errors linked to the registry.

This PR refactors error types in the following way:

  • Upgrade-related errors are only in UpgradeError, not in OrchestratorError. The upgrade module of the orchestrator now only returns UpgradeError instead of OrchestratorError. Also, some specific upgrade errors were added as variants instead of relying on the generic catch-all OrchestratorError::UpgradeError. I think this change should also make it easier to add new upgrade error types when introducing new the new binaries-only "fast" upgrades.
  • Registry-related errors are in a new enum RegistryError and some new variants were added to replace the unnatural occurrences of UpgradeErrors in this module. UpgradeError and OrchestratorError now have a variant RegistryError and a From<RegistryError> implementation to easily cast them.
  • More consistent style and predictable behaviour in registry_helper.rs, in particular where a Ok(None) and an Err are not handled identically anymore.
  • Renamed some variants to omit the Error suffix, following clippy suggestion.

pierugo-dfinity avatar Feb 20 '26 10:02 pierugo-dfinity