replaced `IllegalArgumentException` with `Error`

There is no `IllegalArgumentException` in JS.