errorObject() {

    let error = null;

    if (this.hasErrors()) {

      let errorObject = this.getErrors();
      let message = errorObject._query || 'Validation error';

      error = new Error(message);
      error.details = errorObject;
      error.values = Object.keys(error.details).reduce((values, key) => {
        values[key] = this._data[key];
        return values;
      }, {});
      if (errorObject._query) {
        error.identifier = this._errorDetails._query;
      }

    }

    return error;

  }
Creates an error object for the model if any validations have failed, returns null otherwise
@return {Error}