mirror of
https://github.com/fosrl/pangolin.git
synced 2026-03-01 00:06:38 +00:00
Send error codes down to olm
This commit is contained in:
28
server/routers/olm/error.ts
Normal file
28
server/routers/olm/error.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
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
|
||||
}
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user