Update error handling

This commit is contained in:
delivan 2022-12-20 23:09:26 +09:00
parent fdfbb02f98
commit 25d130073c
3 changed files with 8 additions and 11 deletions

View File

@ -29,7 +29,7 @@ export const queryRegisteredTwitterId = async (
Buffer.from(JSON.stringify(msg)).toString("base64"),
),
{},
true,
{ isErrorIgnore: true },
);
};
@ -61,6 +61,6 @@ export const queryOwnerOfTwitterName = async (
Buffer.from(JSON.stringify(msg)).toString("base64"),
),
{},
true,
{ isErrorIgnore: true },
);
};

View File

@ -5,15 +5,10 @@
import * as Sentry from "@sentry/nextjs";
const SENTRY_DSN = process.env.SENTRY_DSN || process.env.NEXT_PUBLIC_SENTRY_DSN;
const IS_ENABLE_USER_TRACKING =
process.env.NEXT_PUBLIC_IS_ENABLE_USER_TRACKING ||
process.env.NEXT_IS_ENABLE_USER_TRACKING;
Sentry.init({
enabled: IS_ENABLE_USER_TRACKING === "true",
dsn:
SENTRY_DSN ||
"https://78c91641e90f4f7cad28f50aaec9fb95@o4504343701946368.ingest.sentry.io/4504343708827648",
enabled: !!SENTRY_DSN,
dsn: SENTRY_DSN,
// Adjust this value in production, or use tracesSampler for greater control
tracesSampleRate: 1.0,
// ...

View File

@ -5,11 +5,13 @@ import { WALLET_INSTALL_URL } from "../constants/wallet";
export function request<TResponse>(
url: string,
config: RequestInit = {},
isIgnore?: boolean,
customConfig?: {
isErrorIgnore?: boolean;
},
): Promise<TResponse> {
return fetch(url, config)
.then((response) => {
if (!response.ok && !isIgnore) {
if (!response.ok && !customConfig?.isErrorIgnore) {
throw new Error(
`This is an HTTP error: The status is ${response.status} ${response.statusText}`,
);