@barchart/common-js
Version:
Library of common JavaScript utilities
129 lines (128 loc) • 3.47 kB
TypeScript
/**
* An enumeration that describes potential reasons for API failure.
*
* @public
* @extends {Enum}
*/
export default class FailureType extends Enum {
/**
* One or more data points is missing.
*
* @public
* @static
* @returns {FailureType}
*/
public static get REQUEST_CONSTRUCTION_FAILURE(): FailureType;
/**
* A data point is missing.
*
* @public
* @static
* @returns {FailureType}
*/
public static get REQUEST_PARAMETER_MISSING(): FailureType;
/**
* A data point is malformed.
*
* @public
* @static
* @returns {FailureType}
*/
public static get REQUEST_PARAMETER_MALFORMED(): FailureType;
/**
* User identity could not be determined.
*
* @public
* @static
* @returns {FailureType}
*/
public static get REQUEST_IDENTITY_FAILURE(): FailureType;
/**
* User authorization failed.
*
* @public
* @static
* @returns {FailureType}
*/
public static get REQUEST_AUTHORIZATION_FAILURE(): FailureType;
/**
* The request data cannot be parsed or interpreted.
*
* @public
* @static
* @returns {FailureType}
*/
public static get REQUEST_INPUT_MALFORMED(): FailureType;
/**
* The request failed for unspecified reasons.
*
* @public
* @static
* @returns {FailureType}
*/
public static get SCHEMA_VALIDATION_FAILURE(): FailureType;
/**
* The request failed for unspecified reasons.
*
* @public
* @static
* @returns {FailureType}
*/
public static get REQUEST_GENERAL_FAILURE(): FailureType;
/**
* Insufficient permission level to access the resource.
*
* @public
* @static
* @returns {FailureType}
*/
public static get ENTITLEMENTS_FAILED(): FailureType;
/**
* Returns an HTTP status code that would be suitable for use with the
* failure type.
*
* @public
* @static
* @param {FailureType} type
* @returns {number}
*/
public static getHttpStatusCode(type: FailureType): number;
/**
* @param {string} code - The enumeration code (and description).
* @param {string} template - The template string for formatting human-readable messages.
* @param {boolean=} severe - Indicates if the failure is severe (default is true).
* @param {number=} error - The HTTP error code which should be used as part of an HTTP response.
* @param {boolean=} verbose - Indicates if data object should be included when serialized.
*/
constructor(code: string, template: string, severe?: boolean | undefined, error?: number | undefined, verbose?: boolean | undefined);
/**
* The template string for formatting human-readable messages.
*
* @public
* @returns {string}
*/
public get template(): string;
/**
* Indicates if the failure is serious.
*
* @public
* @return {boolean}
*/
public get severe(): boolean;
/**
* The HTTP error code which should be used as part of an HTTP response.
*
* @public
* @return {number|null}
*/
public get error(): number | null;
/**
* Indicates if data object should be included when serialized.
*
* @public
* @return {boolean}
*/
public get verbose(): boolean;
#private;
}
import Enum from './../../lang/Enum.js';