{"version":3,"sources":["../../src/direct/errors.ts"],"sourcesContent":["/**\n * Typed errors for the Direct Data Controller flow.\n *\n * @remarks\n * These extend {@link VanaError} so direct-controller callers can branch on the\n * structured `code` field. The messages map to the failure modes documented in\n * the builder guide (\"Common Errors\").\n *\n * @category Direct\n * @module direct/errors\n */\n\nimport { VanaError } from \"../errors\";\n\n/** Thrown when configuration passed to {@link createDirectDataController} is invalid. */\nexport class DirectConfigError extends VanaError {\n  constructor(\n    message: string,\n    public readonly details?: Record<string, unknown>,\n  ) {\n    super(message, \"DIRECT_CONFIG_ERROR\");\n  }\n}\n\n/**\n * Thrown when {@link DirectDataController.readApprovedData} is called for a\n * request that is not yet approved (missing grantId, scope, or personalServerUrl).\n */\nexport class AccessNotApprovedError extends VanaError {\n  constructor(\n    message = \"Access request is not approved yet\",\n    public readonly details?: Record<string, unknown>,\n  ) {\n    super(message, \"DIRECT_ACCESS_NOT_APPROVED\");\n  }\n}\n\n/**\n * Thrown when a caller asks {@link DirectDataController.readApprovedData} for a\n * scope the user did not approve on this request.\n *\n * @remarks\n * Raised before any network call, so an unapproved scope never reaches the\n * Personal Server and never settles a fee. `details` carries the requested\n * scope and the scopes actually approved.\n */\nexport class ScopeNotApprovedError extends VanaError {\n  constructor(\n    message: string,\n    public readonly details?: Record<string, unknown>,\n  ) {\n    super(message, \"DIRECT_SCOPE_NOT_APPROVED\");\n  }\n}\n\n/** Thrown when the Personal Server cannot be reached or returns an error. */\nexport class PersonalServerReadError extends VanaError {\n  constructor(\n    message: string,\n    public readonly status?: number,\n    public readonly details?: Record<string, unknown>,\n  ) {\n    super(message, \"DIRECT_PERSONAL_SERVER_READ_ERROR\");\n  }\n}\n\n/**\n * Thrown when a Personal Server requires payment (HTTP 402) but no escrow config\n * is set, or the read still requires payment after escrow settlement.\n *\n * @remarks\n * `details` carries structured debug data (`scope`, `grantId`, `asset`,\n * `amount`, and — after a settlement attempt — the `payment` receipt) so callers\n * can see exactly what was owed.\n */\nexport class PaymentRequiredError extends VanaError {\n  constructor(\n    message: string,\n    public readonly details?: Record<string, unknown>,\n  ) {\n    super(message, \"DIRECT_PAYMENT_REQUIRED\");\n  }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAYA,oBAA0B;AAGnB,MAAM,0BAA0B,wBAAU;AAAA,EAC/C,YACE,SACgB,SAChB;AACA,UAAM,SAAS,qBAAqB;AAFpB;AAAA,EAGlB;AAAA,EAHkB;AAIpB;AAMO,MAAM,+BAA+B,wBAAU;AAAA,EACpD,YACE,UAAU,sCACM,SAChB;AACA,UAAM,SAAS,4BAA4B;AAF3B;AAAA,EAGlB;AAAA,EAHkB;AAIpB;AAWO,MAAM,8BAA8B,wBAAU;AAAA,EACnD,YACE,SACgB,SAChB;AACA,UAAM,SAAS,2BAA2B;AAF1B;AAAA,EAGlB;AAAA,EAHkB;AAIpB;AAGO,MAAM,gCAAgC,wBAAU;AAAA,EACrD,YACE,SACgB,QACA,SAChB;AACA,UAAM,SAAS,mCAAmC;AAHlC;AACA;AAAA,EAGlB;AAAA,EAJkB;AAAA,EACA;AAIpB;AAWO,MAAM,6BAA6B,wBAAU;AAAA,EAClD,YACE,SACgB,SAChB;AACA,UAAM,SAAS,yBAAyB;AAFxB;AAAA,EAGlB;AAAA,EAHkB;AAIpB;","names":[]}