mirror of
https://github.com/get-drexa/drive.git
synced 2025-12-01 05:51:39 +00:00
refactor: update remaining error imports to use ErrorCode
- Replace Err.Code with ErrorCode throughout convex model files - Update error() function calls to use new signature - Remove unused Err namespace imports Co-authored-by: Ona <no-reply@ona.com>
This commit is contained in:
@@ -2,7 +2,7 @@ import type { MutationCtx, QueryCtx } from "@fileone/convex/server"
|
||||
import type { Doc } from "../_generated/dataModel"
|
||||
import { authComponent } from "../auth"
|
||||
import { type AuthenticatedQueryCtx, authorizedGet } from "../functions"
|
||||
import * as Err from "../shared/error"
|
||||
import { ErrorCode, error } from "../shared/error"
|
||||
|
||||
export type AuthUser = Awaited<ReturnType<typeof authComponent.getAuthUser>>
|
||||
|
||||
@@ -12,7 +12,10 @@ export type AuthUser = Awaited<ReturnType<typeof authComponent.getAuthUser>>
|
||||
export async function userIdentityOrThrow(ctx: QueryCtx | MutationCtx) {
|
||||
const identity = await ctx.auth.getUserIdentity()
|
||||
if (!identity) {
|
||||
throw Err.create(Err.Code.Unauthenticated, "Not authenticated")
|
||||
error({
|
||||
code: ErrorCode.Unauthenticated,
|
||||
message: "Not authenticated",
|
||||
})
|
||||
}
|
||||
return identity
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user