Add instanceof check for inheriting from Error

* instanceof is faster so put it first:
  http://jsperf.com/error-instanceof-performance
Merge pull request #701 from gregrperkins/error_inheritance

Add instanceof check for inheriting from Error