Instead of throwing a `ValueError`, throw a custom exception depending on the error code
Instead of throwing a
ValueError, throw a custom exception depending on the error code