atp-sdk
Version:
Official TypeScript SDK for Agent Trust Protocol™ - Build secure, verifiable, and trustworthy applications with decentralized identity, verifiable credentials, and robust access control
48 lines • 1.51 kB
JavaScript
// Core types for ATP™ SDK
// Error types
export class ATPError extends Error {
constructor(message, code, statusCode, details) {
super(message);
this.code = code;
this.statusCode = statusCode;
this.details = details;
this.name = 'ATPError';
}
}
export class ATPNetworkError extends ATPError {
constructor(message, cause) {
super(message, 'NETWORK_ERROR');
this.cause = cause;
this.name = 'ATPNetworkError';
}
}
export class ATPAuthenticationError extends ATPError {
constructor(message = 'Authentication failed') {
super(message, 'AUTH_ERROR', 401);
this.name = 'ATPAuthenticationError';
}
}
export class ATPAuthorizationError extends ATPError {
constructor(message = 'Authorization failed') {
super(message, 'AUTHZ_ERROR', 403);
this.name = 'ATPAuthorizationError';
}
}
export class ATPValidationError extends ATPError {
constructor(message, validationErrors, field, value) {
super(message, 'VALIDATION_ERROR', 400);
this.validationErrors = validationErrors;
this.field = field;
this.value = value;
this.name = 'ATPValidationError';
}
}
export class ATPServiceError extends ATPError {
constructor(message, service, operation) {
super(message, 'SERVICE_ERROR', 500);
this.service = service;
this.operation = operation;
this.name = 'ATPServiceError';
}
}
//# sourceMappingURL=types.js.map