Home Manual Reference Source
public class | source

ValidationError

Extends:

ApiError → ValidationError

Extension of ApiError containing an extra field for validation errors

Constructor Summary

Public Constructor
public

constructor(error: AxiosError, request: XMLHttpRequest | ClientRequest, response: AxiosResponse)

Member Summary

Public Members
public get

True if the error contains schema errors

public get

Get validation error messages

public get

Get the schema errors if available

public get

Any validation errors

Method Summary

Public Methods
public

Inherited Summary

From class ApiError
public get

code: Number: *

Http error code

public get

config: AxiosRequestConfig: *

Get the request config

public get

Returns if the error contained a stacktrace that has been parsed This should only be true if the API is in debug mode.

public get

Error message

public get

Get the axios request

public get

response: AxiosResponse: *

Get the axios response

public get

trace: Array<{line: Number, file: String, code: String}>: *

Get the parsed stacktrace from the error

public get

type: String: *

Error type

public

Display-able string

Public Constructors

public constructor(error: AxiosError, request: XMLHttpRequest | ClientRequest, response: AxiosResponse) source

Override:

ApiError#constructor

Params:

NameTypeAttributeDescription
error AxiosError

Axios error

error.config AxiosRequestConfig

Request config

request XMLHttpRequest | ClientRequest

Request

response AxiosResponse

Response

Public Members

public get hasSchemaErrors: boolean: * source

True if the error contains schema errors

Return:

boolean

Has schema errors

public get messages: Array<String>: * source

Get validation error messages

Return:

Array<String>

All validation messages

public get schemaErrors: SchemaError[]: * source

Get the schema errors if available

Return:

SchemaError[]

Array containing schema errors

Example:


[
  {
    "property": "data.meta",
    "pointer": "/data/meta",
    "message": "The property meta is required",
    "constraint": {
      "name": "required",
      "params": {
        "property": "meta"
      }
    },
    "context": 1
  },
   {
    "property": "data.paper",
    "pointer": "/data/paper",
    "message": "The property paper is required",
    "constraint": {
      "name": "required",
      "params": {
        "property": "paper"
      }
    },
    "context": 1
  },
   {
    "property": "data.scaleDefinition",
    "pointer": "/data/scaleDefinition",
    "message": "The property scaleDefinition is required",
    "constraint": {
      "name": "required",
      "params": {
        "property": "scaleDefinition"
      }
    },
    "context": 1
  }
]

See:

public get validationErrors: Object<String, Array<String>>: * source

Any validation errors

Return:

Object<String, Array<String>>

Object containing arrays of validation errors where the field is stored in the key

Public Methods

public toString(): string source

Display-able string

Override:

ApiError#toString

Return:

string