Why String.indexOf do not use exception but return -1 when substring not found?

The purpose of this question is: when we start custom exception.

I believe avoid the need to return special error code is right design path.

What's your opinion?

Edit
Report