Files
cal.diy/apps/web/pages/sandbox/test-async-error.tsx
T
2f8bd3c07a add trpc v10 (#4683)
* revert me later

* let's see if this builds

* fix dupe proc

* fix: v10 works

* fix type error

* fix type error

* fix type errors

* fix more

* add example procedure

* spreading not needed

* Update yarn.lock

* Revert "revert me later"

This reverts commit 0c8c15d0577e0c287223039c7b6958b2b0c12c69.

Co-authored-by: Chris Bautista <chrisbautista@netflix.com>
Co-authored-by: Peer Richelsen <peeroke@gmail.com>
Co-authored-by: Omar López <zomars@me.com>
Co-authored-by: Alex van Andel <me@alexvanandel.com>
2022-09-29 16:58:29 +00:00

27 lines
694 B
TypeScript

import { useQuery } from "@tanstack/react-query";
import React from "react";
import { HttpError } from "@lib/core/http/error";
const TestAsyncErrorRoute: React.FC = () => {
const { error, isLoading } = useQuery(["error-promise"], async () => {
throw new HttpError({
statusCode: 400,
message: "A http error occurred on the client side in test-async-error.tsx.",
url: "http://awebsite.that.does.not.exist",
});
});
if (isLoading) {
return <>Loading...</>;
}
if (error) {
console.log("An error occurred", error);
throw error;
}
return <>If you see this message, there is really something wrong ;)</>;
};
export default TestAsyncErrorRoute;