Replace `isinstanceof Error` with a better `isError` check

Fixes #237 (hopefully)