Skip to content

(UBI) Error handling in ZTP component

Proposers

  • Vasilis Katopodis (Ubitech)
  • Kostas Poulakakis (Ubitech)
  • Panagiotis Famelis (Ubitech) ...

Description

ZTP components (ex Automation) has a couple of bugs in how it handles failures. In the ZtpServiceImpl.java we have the following pattern in almost all of the methods:

        deserializedDeviceUni
                .onFailure()
                .recoverWithNull()
                .subscribe()
                .with(
[...]
                );

        return deserializedDeviceUni;

This is obviously wrong. Because we first subscribe on the deserializedDeviceUni and then return it. This means that essentially the first subscription is wasted, as we would have already returned a Uni, before its value has been given. Also, essentially, this tries to do error handling, but in reality it does not.

ZTP should be refactored to make the handling of failure in a better way, as we did with Policy. In Policy, @kpoulakakis did a pretty good job on how to error handle, we should follow the same pattern here.

Demo or definition of done

ZtpServiceImpl.java has been refactored

References

N/A

Edited by Panagiotis Famelis