How to customize Ember Data error messages

How can I customize/translate Ember Data generic error messages “Adapter operation failed”. Validation errors I have already translated on server side, but sometimes something unexpected happens (HTTP 500, network error etc). How can I customize those default error messages?

Any ideas how to solve this?

You can override the handResponse() function in your adapter.

E.g.

handleResponse (status, headers, payload, requestData) {
  if (status === 500) {
    return new Error("My custom error 500 message");
  }

  return payload;
}