improve error handling

This commit is contained in:
Brandon Egger 2023-08-29 10:51:10 -05:00
parent 562ff8d2a6
commit 41a0562228

View File

@ -28,17 +28,14 @@ export const auditoryResourceRouter = createTRPCRouter({
}); });
if (!resource) { if (!resource) {
throw new TRPCError({ throw Error('not found');
code: "NOT_FOUND",
message: "The resource you are looking for was not found.",
});
} }
return resource; return resource;
} catch (e) { } catch (e) {
throw new TRPCError({ throw new TRPCError({
code: "NOT_FOUND", code: "NOT_FOUND",
message: "The resource you are looking for was not found.", message: "The resource you are looking for does not exist.",
cause: e, cause: e,
}); });
} }