[READ ONLY MIRROR] Spark Social AppView Server github.com/sprksocial/server
atproto deno hono lexicon
5
fork

Configure Feed

Select the types of activity you want to include in your feed.

correct getProfile Errors (#27)

authored by

Davi Rodrigues and committed by
GitHub
5c886465 ac638b58

+4 -7
+4 -7
services/appview/api/so/sprk/actor/getProfile.ts
··· 5 5 import type * as SoSprkActorDefs from "../../../../lexicon/types/so/sprk/actor/defs.ts"; 6 6 import { AppContext } from "../../../../main.ts"; 7 7 import { StoryDocument } from "../../../../data-plane/server/index.ts"; 8 + import { XRPCError } from "@sprk/xrpc-server"; 8 9 9 10 export default function (server: Server, ctx: AppContext) { 10 11 server.so.sprk.actor.getProfile({ ··· 15 16 ? auth.credentials.iss 16 17 : undefined; 17 18 18 - if (!actorParam) { 19 - throw new Error("Actor not provided"); 20 - } 21 - 22 19 let actorDidDoc; 23 20 if (isValidHandle(actorParam)) { 24 21 actorDidDoc = await ctx.resolver.resolveHandleToDidDoc(actorParam); ··· 27 24 ensureValidDid(actorParam); 28 25 actorDidDoc = await ctx.resolver.resolveDidToDidDoc(actorParam); 29 26 } catch (_err) { 30 - throw new Error("Invalid actor"); 27 + throw new XRPCError(400, "Invalid actor"); 31 28 } 32 29 } 33 30 ··· 63 60 } 64 61 65 62 if (!actorDoc) { 66 - throw new Error("Actor not found"); 63 + throw new XRPCError(404, "Actor not found", "NotFound"); 67 64 } 68 65 69 66 if (!profile) { 70 - throw new Error("Profile not found"); 67 + throw new XRPCError(404, "Profile not found", "NotFound"); 71 68 } 72 69 73 70 // Use actor's handle if available, otherwise resolve from DID