})

				It("delegates MissingKindOrClientErrors as webutil.ValidationError to the ErrorWriter", func() {
					updater.ExecuteCall.Returns.Error = services.MissingKindOrClientError("BOOM!")

					handler.ServeHTTP(writer, request, context)

					Expect(errorWriter.WriteCall.Receives.Error).To(Equal(webutil.ValidationError([]string{"BOOM!"})))

					Expect(transaction.BeginCall.WasCalled).To(BeTrue())
					Expect(transaction.CommitCall.WasCalled).To(BeFalse())
					Expect(transaction.RollbackCall.WasCalled).To(BeTrue())
				})

				It("delegates CriticalKindErrors as webutil.ValidationError to the ErrorWriter", func() {
					updater.ExecuteCall.Returns.Error = services.CriticalKindError("BOOM!")

					handler.ServeHTTP(writer, request, context)

					Expect(errorWriter.WriteCall.Receives.Error).To(Equal(webutil.ValidationError([]string{"BOOM!"})))

					Expect(transaction.BeginCall.WasCalled).To(BeTrue())
					Expect(transaction.CommitCall.WasCalled).To(BeFalse())
					Expect(transaction.RollbackCall.WasCalled).To(BeTrue())
				})

				It("delegates other errors to the ErrorWriter", func() {
					updater.ExecuteCall.Returns.Error = errors.New("BOOM!")

					handler.ServeHTTP(writer, request, context)
					{
						ClientID: "raptors",
						ID:       "hungry",
						Critical: true,
					},
					{
						ClientID: "dogs",
						ID:       "barking",
					},
				}
			})

			It("should return a CriticalKindError", func() {
				preferences := []models.Preference{
					{
						ClientID: "raptors",
						KindID:   "hungry",
					},
					{
						ClientID: "dogs",
						KindID:   "barking",
					},
				}

				err := updater.Update(conn, preferences, false, "the-user")
				Expect(err).To(Equal(services.CriticalKindError("The kind 'hungry' for the 'raptors' client is critical and cannot be unsubscribed from")))
			})
		})
	})
})