logux-error.js
function LoguxError (type, options, received) {
  Error.call(this, type)

  /**
   * Always equal to `LoguxError`. The best way to check error class.
   * @type {string}
   *
   * @example
   * if (error.name === 'LoguxError') { }
   */
  this.name = 'LoguxError'

  /**
   * The error code.
   * @type {string}
   *
   * @example
   * if (error.type === 'timeout') {
   *   fixNetwork()
   * }
   */
  this.type = type

  /**
   * Error options depends on error type.
   * @type {any}
   *
   * @example
   * if (error.type === 'timeout') {
   *   console.error('A timeout was reached (' + error.options + ' ms)')
   * }
   */
  this.options = options

  /**
   * Human-readable error description.
   * @type {string}
   *
   * @example
   * console.log('Server throws: ' + error.description)
   */
  this.description = LoguxError.describe(type, options)

  /**
   * Was error received from remote client.
   * @type {boolean}
   */
  this.received = !!received

  this.message = ''
  if (received) {
    this.message += 'Logux received ' + this.type + ' error'
    if (this.description !== this.type) {
      this.message += ' (' + this.description + ')'
    }
  } else {
    this.message = this.description
  }

  if (Error.captureStackTrace) {
    Error.captureStackTrace(this, LoguxError)
  }
}
function LoguxError (type, options, received) {
  Error.call(this, type)

  /**
   * Always equal to `LoguxError`. The best way to check error class.
   * @type {string}
   *
   * @example
   * if (error.name === 'LoguxError') { }
   */
  this.name = 'LoguxError'

  /**
   * The error code.
   * @type {string}
   *
   * @example
   * if (error.type === 'timeout') {
   *   fixNetwork()
   * }
   */
  this.type = type

  /**
   * Error options depends on error type.
   * @type {any}
   *
   * @example
   * if (error.type === 'timeout') {
   *   console.error('A timeout was reached (' + error.options + ' ms)')
   * }
   */
  this.options = options

  /**
   * Human-readable error description.
   * @type {string}
   *
   * @example
   * console.log('Server throws: ' + error.description)
   */
  this.description = LoguxError.describe(type, options)

  /**
   * Was error received from remote client.
   * @type {boolean}
   */
  this.received = !!received

  this.message = ''
  if (received) {
    this.message += 'Logux received ' + this.type + ' error'
    if (this.description !== this.type) {
      this.message += ' (' + this.description + ')'
    }
  } else {
    this.message = this.description
  }

  if (Error.captureStackTrace) {
    Error.captureStackTrace(this, LoguxError)
  }
}
function LoguxError ( type , options , received ) { Error . call ( this , type ) /**
   * Always equal to `LoguxError`. The best way to check error class.
   * @type {string}
   *
   * @example
   * if (error.name === 'LoguxError') { }
   */ this . name = 'LoguxError' /**
   * The error code.
   * @type {string}
   *
   * @example
   * if (error.type === 'timeout') {
   *   fixNetwork()
   * }
   */ this . type = type /**
   * Error options depends on error type.
   * @type {any}
   *
   * @example
   * if (error.type === 'timeout') {
   *   console.error('A timeout was reached (' + error.options + ' ms)')
   * }
   */ this . options = options /**
   * Human-readable error description.
   * @type {string}
   *
   * @example
   * console.log('Server throws: ' + error.description)
   */ this . description = LoguxError . describe ( type , options ) /**
   * Was error received from remote client.
   * @type {boolean}
   */ this . received = ! ! received this . message = '' if ( received ) { this . message += 'Logux received ' + this . type + ' error' if ( this . description !== this . type ) { this . message += ' (' + this . description + ')' } } else { this . message = this . description } if ( Error . captureStackTrace ) { Error . captureStackTrace ( this , LoguxError ) } }
Logux error in logs synchronization.

@param {string} type The error code.
@param {any} options The error option.
@param {boolean} received Was error received from remote node.

@example
if (error.name === 'LoguxError') {
console.log('Server throws: ' + error.description)
}

@extends Error
@class
Logux error in logs synchronization .