It may not be clear when to raise an exception and when to use
raiseif the caller called your function in an invalid way, and it doesn’t make sense to continue.
log.error()if the hardware itself is misbehaving, and throwing an error immediately would leave it an invalid state.
Even if you do eventually throw an exception (if you weren’t able to do it immediately), you should also
log.error() so that the simulation time of when things went wrong is recorded.
log.error() is for humans only,
raise is for both humans and code.