Replaced `return ID_ERROR` with the appropriate exceptions