Rich-Harris / magic-string

Manipulate strings like a wizard
MIT License
2.34k stars 113 forks source link

Better error message for invalid input #288

Open benmccann opened 1 week ago

benmccann commented 1 week ago

If you pass -1 as the start to update the error you get is:

throw new Error('Cannot overwrite across a split point');

It'd be nice to do some validation and throw a nicer error or include indices in the existing error message