Feat/parse invitation

This commit is contained in:
Kuldeep
2026-10-05 12:59:22 +00:00
parent d907946804
commit 0c95b9b2b1
19 changed files with 1008 additions and 386 deletions
+46
View File
@@ -0,0 +1,46 @@
/* eslint-disable max-classes-per-file */
/**
* Thrown when a value does not satisfy the XOInvitation schema.
*/
export class InvitationInvalidError extends Error {
constructor(details: string) {
const defaultMessage = `Invitation invalid, expected a value matching the XOInvitation type, but got: ${details}`;
super(defaultMessage);
this.name = 'InvitationInvalidError';
}
}
/**
* Thrown when invitation share JSON cannot be parsed.
*/
export class InvitationJsonMalformedError extends Error {
/**
* Parser failure forwarded from JSON parsing.
*/
readonly reason: string;
constructor(reason: string) {
const defaultMessage = `Invitation JSON malformed: expected a valid JSON string, but got: ${reason}`;
super(defaultMessage);
this.name = 'InvitationJsonMalformedError';
this.reason = reason;
}
}
/**
* Thrown when invitation serialization fails.
*/
export class InvitationSerializationFailedError extends Error {
/**
* Serializer failure forwarded from the serialization path.
*/
readonly reason: string;
constructor(reason: string) {
const defaultMessage = `Invitation serialization failed: ${reason}`;
super(defaultMessage);
this.name = 'InvitationSerializationFailedError';
this.reason = reason;
}
}