Class InvalidError


A InvalidError is used by an adapter to signal the external API was unable to process a request because the content was not semantically correct or meaningful per the API. Usually, this means a record failed some form of server-side validation. When a promise from an adapter is rejected with a InvalidError the record will transition to the invalid state and the errors will be set to the errors property on the record.

For Ember Data to correctly map errors to their corresponding properties on the model, Ember Data expects each error to be a valid JSON-API error object with a source/pointer that matches the property name. For example, if you had a Post model that looked like this.

import Model, { attr } from '@ember-data/model';

export default class PostModel extends Model {