src/back/models/errors.js
function AttributeTypeNotFoundError(type, innerError) {
  /**
   * The attribute type that was not found.
   * @type {?string}
   */
  this.type = type;
  /**
   * The inner error that generated the current error.
   * @type {?Error}
   */
  this.innerError = innerError;

  expect(arguments).to.have.length.below(
    3,
    'Invalid arguments length when creating a new ' +
    'AttributeTypeNotFoundError (it has to be passed less than 3 arguments)'
  );

  this.name = 'AttributeTypeNotFoundError';

  this.message = 'Cannot find Attribute type';
  if (type) {
    expect(type).to.be.a(
      'string',
      'Invalid argument "type" when creating a new ' +
      'AttributeTypeNotFoundError (it has to be a string)'
    );
    this.message += ' "' + type + '"';
  }

  this.stack = (new Error(this.message)).stack;
  if (innerError) {
    expect(innerError).to.be.an.instanceof(
      Error,
      'Invalid argument "innerError" when creating a new ' +
      'AttributeTypeNotFoundError (it has to be an Error)'
    );
    this.stack += '\n\n' + innerError.stack;
  }
}
function AttributeTypeNotFoundError(type, innerError) {
  /**
   * The attribute type that was not found.
   * @type {?string}
   */
  this.type = type;
  /**
   * The inner error that generated the current error.
   * @type {?Error}
   */
  this.innerError = innerError;

  expect(arguments).to.have.length.below(
    3,
    'Invalid arguments length when creating a new ' +
    'AttributeTypeNotFoundError (it has to be passed less than 3 arguments)'
  );

  this.name = 'AttributeTypeNotFoundError';

  this.message = 'Cannot find Attribute type';
  if (type) {
    expect(type).to.be.a(
      'string',
      'Invalid argument "type" when creating a new ' +
      'AttributeTypeNotFoundError (it has to be a string)'
    );
    this.message += ' "' + type + '"';
  }

  this.stack = (new Error(this.message)).stack;
  if (innerError) {
    expect(innerError).to.be.an.instanceof(
      Error,
      'Invalid argument "innerError" when creating a new ' +
      'AttributeTypeNotFoundError (it has to be an Error)'
    );
    this.stack += '\n\n' + innerError.stack;
  }
}
function AttributeTypeNotFoundError ( type , innerError ) { /**
   * The attribute type that was not found.
   * @type {?string}
   */ this . type = type ; /**
   * The inner error that generated the current error.
   * @type {?Error}
   */ this . innerError = innerError ; expect ( arguments ) . to . have . length . below ( 3 , 'Invalid arguments length when creating a new ' + 'AttributeTypeNotFoundError (it has to be passed less than 3 arguments)' ) ; this . name = 'AttributeTypeNotFoundError' ; this . message = 'Cannot find Attribute type' ; if ( type ) { expect ( type ) . to . be . a ( 'string' , 'Invalid argument "type" when creating a new ' + 'AttributeTypeNotFoundError (it has to be a string)' ) ; this . message += ' "' + type + '"' ; } this . stack = ( new Error ( this . message ) ) . stack ; if ( innerError ) { expect ( innerError ) . to . be . an . instanceof ( Error , 'Invalid argument "innerError" when creating a new ' + 'AttributeTypeNotFoundError (it has to be an Error)' ) ; this . stack += '\n\n' + innerError . stack ; } }
Error class to be used when an Attribute type was referenced and the platform
was not able to find it.
@constructor
@extends Error
@param {?string} [type] The attribute type name to be displayed.
@param {?Error} [innerError] The inner error.
@memberof module:back4app-entity/models/errors
@example
try {
var TypedAttribute = types.get('MyCustomAttribute');
}
catch (e) {
throw new AttributeTypeNotFoundError('MyCustomAttribute', e);
}
Error class to be used when an Attribute type was referenced and the platform was not able to find it .