raise exception only if it's not None