change @assert to proper condition checking
replace @assert ->
isempty(...) && throw(ArgumentError())