<commit_before>/**
  @module ember-data
*/

var get = Ember.get, set = Ember.set;
var map = Ember.ArrayPolyfills.map;

var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack'];

/**
  A `DS.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 `DS.InvalidError` the record will
  transition to the `invalid` state and the errors will be set to the
  `errors` property on the record.

  Example

  ```javascript
  App.ApplicationAdapter = DS.RESTAdapter.extend({
    ajaxError: function(jqXHR) {
      var error = this._super(jqXHR);

      if (jqXHR && jqXHR.status === 422) {
        var jsonErrors = Ember.$.parseJSON(jqXHR.responseText)["errors"];
        return new DS.InvalidError(jsonErrors);
      } else {
        return error;
      }
    }
  });
  ```

  @class InvalidError
  @namespace DS
*/
var InvalidError = function(errors) {
  var tmp = Error.prototype.constructor.call(this, "The backend rejected the commit because it was invalid: " + Ember.inspect(errors));
  this.errors = errors;

  for (var i=0, l=errorProps.length; i<l; i++) {
    this[errorProps[i]] = tmp[errorProps[i]];
  }
};
InvalidError.prototype = Ember.create(Error.prototype);

/**
  An adapter is an object that receives requests from a store and
  translates them into the appropriate action to take against your
  persistence layer. The persistence layer is usually an HTTP API, but
  may be anything, such as the browser's local storage. Typically the
  adapter is not invoked directly instead its functionality is accessed
  through the `store`.

  ### Creating an Adapter

  First, create a new subclass of `DS.Adapter`:

  ```javascript
  App.MyAdapter = DS.Adapter.extend({
    // ...your code here
  });
  ```<commit_msg>Document required structure for DS.InvalidError<commit_after>/**
  @module ember-data
*/

var get = Ember.get, set = Ember.set;
var map = Ember.ArrayPolyfills.map;

var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack'];

/**
  A `DS.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 `DS.InvalidError` the record will
  transition to the `invalid` state and the errors will be set to the
  `errors` property on the record.

  Example

  ```javascript
  App.ApplicationAdapter = DS.RESTAdapter.extend({
    ajaxError: function(jqXHR) {
      var error = this._super(jqXHR);

      if (jqXHR && jqXHR.status === 422) {
        var jsonErrors = Ember.$.parseJSON(jqXHR.responseText)["errors"];
        return new DS.InvalidError(jsonErrors);
      } else {
        return error;
      }
    }
  });
  ```
  
  The `DS.InvalidError` must be constructed with a single object whose
  keys are the invalid model properties, and whose values are the
  corresponding error messages. For example:
  
  ```javascript
  return new DS.InvalidError({
    length: 'Must be less than 15',
    name: 'Must not be blank
  });
  ```

  @class InvalidError
  @namespace DS
*/
var InvalidError = function(errors) {
  var tmp = Error.prototype.constructor.call(this, "The backend rejected the commit because it was invalid: " + Ember.inspect(errors));
  this.errors = errors;

  for (var i=0, l=errorProps.length; i<l; i++) {
    this[errorProps[i]] = tmp[errorProps[i]];
  }
};
InvalidError.prototype = Ember.create(Error.prototype);

/**
  An adapter is an object that receives requests from a store and
  translates them into the appropriate action to take against your
  persistence layer. The persistence layer is usually an HTTP API, but
  may be anything, such as the browser's local storage. Typically the
  adapter is not invoked directly instead its functionality is accessed
  through the `store`.

  ### Creating an Adapter

  First, create a new subclass of `DS.Adapter`:

  ```javascript
  App.MyAdapter = DS.Adapter.extend({
    // ...your code here
  });
  ```
{'fraction_non_alphanumeric': 0.10280588776448941, 'fraction_numerical': 0.0022999080036798527, 'mean_word_length': 3.5302083333333334, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7577106', 'n_tokens_mistral': 1277, 'n_tokens_neox': 1224, 'n_words': 487}