replace early returns with NotFoundError

test /api/webhook/incoming-message
This commit is contained in:
m5r
2021-08-02 21:43:27 +08:00
parent 827ed9f1c0
commit 2cf53533a3
11 changed files with 223 additions and 28 deletions

View File

@ -1,4 +1,4 @@
import { useQuery } from "blitz";
import { NotFoundError, useQuery } from "blitz";
import useCurrentCustomer from "../../core/hooks/use-current-customer";
import getPhoneCalls from "../queries/get-phone-calls";
@ -6,7 +6,7 @@ import getPhoneCalls from "../queries/get-phone-calls";
export default function usePhoneCalls() {
const { customer } = useCurrentCustomer();
if (!customer) {
throw new Error("customer not found");
throw new NotFoundError();
}
const { phoneCalls } = useQuery(getPhoneCalls, { customerId: customer.id })[0];