Change error handling to use assert as per Araq's comment
This commit is contained in:
parent
40d034b7e3
commit
80a727f1ce
1 changed files with 1 additions and 4 deletions
|
|
@ -808,10 +808,7 @@ proc split*(s: string, sep: string, maxsplit: int = -1): seq[string] {.noSideEff
|
||||||
##
|
##
|
||||||
## Substrings are separated by the string `sep`. This is a wrapper around the
|
## Substrings are separated by the string `sep`. This is a wrapper around the
|
||||||
## `split iterator <#split.i,string,string>`_.
|
## `split iterator <#split.i,string,string>`_.
|
||||||
##
|
assert(sep.len > 0)
|
||||||
## If `sep` is an empty string, `ValueError` is raised.
|
|
||||||
if sep.len == 0:
|
|
||||||
raise newException(ValueError, "invalid separator: empty string not allowed")
|
|
||||||
|
|
||||||
accumulateResult(split(s, sep, maxsplit))
|
accumulateResult(split(s, sep, maxsplit))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue