nav-connect
Version:
Nav Online Invoice connection module
74 lines (73 loc) • 2.61 kB
TypeScript
import type { FunctionCodeType, TechnicalValidationResultType } from "nav-osa-types";
/**
* Base error class for all NAV API errors.
*/
export declare class NavApiError extends Error {
readonly cause?: unknown | undefined;
constructor(message: string, cause?: unknown | undefined);
}
/**
* Thrown when the HTTP request times out (httpTimeoutMs exceeded).
*/
export declare class NavApiTimeoutError extends NavApiError {
readonly timeoutMs: number;
constructor(timeoutMs: number);
}
/**
* Thrown when the NAV API returns an HTTP error with a parseable XML error body.
* Contains the structured funcCode, errorCode, message, and optional validation messages.
*/
export declare class NavApiResponseError extends NavApiError {
readonly funcCode: FunctionCodeType;
readonly errorCode?: string;
readonly httpStatus?: number;
readonly technicalValidationMessages?: TechnicalValidationResultType[];
constructor(params: {
funcCode: FunctionCodeType;
errorCode?: string;
message?: string;
httpStatus?: number;
technicalValidationMessages?: TechnicalValidationResultType[];
});
}
/**
* Thrown when the NAV API returns an HTTP error but the body cannot be parsed.
*/
export declare class NavApiHttpError extends NavApiError {
readonly httpStatus: number;
readonly statusText?: string;
readonly responseBody?: string;
constructor(httpStatus: number, statusText?: string, responseBody?: string, cause?: unknown);
}
/**
* Thrown when the generated XML fails XSD validation before sending.
*/
export declare class NavXmlValidationError extends NavApiError {
readonly requestType: string;
readonly validationErrors: string[];
constructor(requestType: string, validationErrors: string[]);
}
/**
* Thrown when the NAV API response XML fails XSD validation during parsing.
* Wraps the XmlValidationError from nav-osa-core.
*/
export declare class NavResponseXmlValidationError extends NavApiError {
readonly validationErrors: string[];
readonly xsdPath?: string;
constructor(validationErrors: string[], xsdPath?: string);
}
/**
* Thrown when the NavApiConfig is invalid.
*/
export declare class NavConfigError extends NavApiError {
readonly validationErrors: string[];
constructor(validationErrors: string[]);
}
/**
* Thrown when the requested date range exceeds the NAV API limit (35 days).
*/
export declare class NavDateRangeError extends NavApiError {
readonly requestedDays: number;
readonly maxDays: number;
constructor(requestedDays: number, maxDays?: number);
}