making sure the error returned to user is `instanceof Error`