improve error handling
This commit is contained in:
parent
562ff8d2a6
commit
41a0562228
@ -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,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user