Tweak assert.throws to validate error.code