UNPKG

smartapi-typescript

Version:

TypeScript library for Angel One SmartAPI broker API

80 lines (79 loc) 2.19 kB
/** * SmartAPI Error Codes * Error responses come with the name of the exception generated internally by the API server. * These can be used to define corresponding exceptions in your code. */ /** * Error codes and their descriptions from official Angel One SmartAPI documentation */ export declare const ERROR_CODES: { AG8001: string; AG8002: string; AG8003: string; AB8050: string; AB8051: string; AB1000: string; AB1001: string; AB1002: string; AB1003: string; AB1004: string; AB1005: string; AB1006: string; AB1031: string; AB1032: string; AB1007: string; AB1008: string; AB1009: string; AB1010: string; AB1011: string; AB1012: string; AB1013: string; AB1014: string; AB1015: string; AB1016: string; AB1017: string; AB1018: string; AB4008: string; AB2002: string; AB2000: string; AB2001: string; }; /** * Error code categories */ export declare enum ErrorCategory { AUTHENTICATION = "AUTHENTICATION", USER = "USER", ORDER = "ORDER", GENERIC = "GENERIC" } /** * Get the category of an error code * @param errorCode Error code to categorize * @returns Error category */ export declare function getErrorCategory(errorCode: string): ErrorCategory; /** * Check if an error is an authentication error * @param errorCode Error code to check * @returns True if the error is an authentication error */ export declare function isAuthenticationError(errorCode: string): boolean; /** * Check if an error is a user-related error * @param errorCode Error code to check * @returns True if the error is a user-related error */ export declare function isUserError(errorCode: string): boolean; /** * Check if an error is an order-related error * @param errorCode Error code to check * @returns True if the error is an order-related error */ export declare function isOrderError(errorCode: string): boolean; /** * Get the description for an error code * @param errorCode Error code to get description for * @returns Error description or "Unknown Error" if not found */ export declare function getErrorDescription(errorCode: string): string;