Mirage error responses for jsonAPI ember-data

Hello, I am currently struggling to create a valid error response in mirage for a patch request.

my config looks like this

server.patch(`api/v2/students/:id`, function () {
  // example Error response from the server
  return new Mirage.Response(422, {}, {
    errors: [
        'status': 422,
        'title': 'wth',
        'detail': 'login has already been taken',
        'source': {
          'pointer': '/data/attributes/login',

and when I try to save the model object via .save() I am presented with a super duper annoying error message-> The adapter rejected the commit because it was invalid

I am really a little clueless at this point and I hope someone could help me out with this one. I am using ember 2.18, same for ember data.

I think you’re on the right path here. Ember Data is letting you know that the model didn’t successfully save because the mirage server responded with a 422. In fact, if you add {{model.isInvalid}} to your template, you’ll see that become true.

I see that your error object has a detail of login has already been taken. Do you want that displayed on the screen? In the console? Something else?

Hello, the detail prop has atm the purpose to identify a 422 error and then replace it with a proper translation. In the future our API will return an error code which will be used to do just that. Am I maybe missing headers, like content-type and accept?