Yanked from https://git.io/vS8DV re-used under CC0 with some tiny modifications
function isError(value) {
	  switch (Object.prototype.toString.call(value)) {
	    case '[object Error]':
	      return true;

	    case '[object Exception]':
	      return true;

	    case '[object DOMException]':
	      return true;

	    default:
	      return value instanceof Error;
	  }
	}