Replace assertions with explicit errors.