mirror of
https://github.com/fosrl/pangolin.git
synced 2026-01-28 22:00:51 +00:00
29 lines
811 B
TypeScript
29 lines
811 B
TypeScript
import { sendToClient } from "#dynamic/routers/ws";
|
|
// Error codes for registration failures
|
|
export const OlmErrorCodes = {
|
|
OLM_NOT_FOUND: "OLM_NOT_FOUND",
|
|
CLIENT_ID_NOT_FOUND: "CLIENT_ID_NOT_FOUND",
|
|
CLIENT_NOT_FOUND: "CLIENT_NOT_FOUND",
|
|
CLIENT_BLOCKED: "CLIENT_BLOCKED",
|
|
ORG_NOT_FOUND: "ORG_NOT_FOUND",
|
|
USER_ID_NOT_FOUND: "USER_ID_NOT_FOUND",
|
|
INVALID_USER_SESSION: "INVALID_USER_SESSION",
|
|
USER_ID_MISMATCH: "USER_ID_MISMATCH",
|
|
ACCESS_POLICY_DENIED: "ACCESS_POLICY_DENIED"
|
|
} as const;
|
|
|
|
// Helper function to send registration error
|
|
export async function sendOlmError(
|
|
code: string,
|
|
errorMessage: string,
|
|
olmId: string
|
|
) {
|
|
sendToClient(olmId, {
|
|
type: "olm/error",
|
|
data: {
|
|
code,
|
|
message: errorMessage
|
|
}
|
|
});
|
|
}
|