mirror of
https://github.com/MetaFam/TheGame.git
synced 2026-01-14 08:58:02 -05:00
* linting 🃡 * removing MetaMask specificity 🃢 * moving `StrictMode` to Next.js 🃣 * compressing & commafying 🃤 * upgrading eslint 👘 * removing preface from guild name 🃥 * removing unnecessary ESLint `no-console` directives 🌂 * fixing a typo in a comment 🃦 * updating GraphQL codegen for paid subgraph 🦏 * replacing Discord invite link 📌 * passing through The Graph API token to Docker ♾ * setting Docker ARG to set ENV 📟 * missed a file rename in frontend Docker config 🦀 * adding ts-node to fix Docker build issue ⸙ * trying to narrow down the 500 error's source in the test instance ⛄ * exposing The Graph API token on Cloud Run 🦃 * more logging to try & find server error 🐠 * more logging 🧱 * trying to run Node.js in development mode on Cloud Run 🎁 * reconfiguring frontend Dockerfile to also run the dev environment 🌿 * dev mode seems to function 🧨 * 768MiB wasn't enough memory 🍁 * 1GiB wasn't enough memory 🔱 * 1.5GiB was interpreted as 1GiB 🥃 * 1536MiB wasn't enough memory 👾 * 2GiB wasn't enough memory 🧲 * 3GiB wasn't enough memory 🆎 * 4GiB might have been enough, but it still doesn't load 🧻 * 5GiB requires two CPUs 📝 * giving up on dev server; unexplained HTTP 429s 🎨 * disabling Honeybadger in test instances 📮 * trying an `ErrorBoundary` to gather more info 🕷 * setting GraphQL endpoint 🇲🇰 * exposing environment variables ⛈ * trying to expose `` 📻 * the Next compiled version still references `node_modules` 🦢 * removing Alchemy API key from sources ⛺ * trying a different Docker build action 💉 * removing logging 🍿 * switching to Docker Buildx 👠 * missed an escaped newline 🗿 * trying a newer gcloud setup action 🦝 * hopefully fixing authentication 📴 * bunch of changes to the meTokens profile section 🦜 * need credentials file 🐆 * hunting for layout load error & pushing debug statements to testing 🥁 * updating eslint 💓 * trying to debug the missing Breadchain Coop 🧀 * apparently chose the wrong changeset 🐚 * removing logging 🥀
63 lines
2.0 KiB
TypeScript
63 lines
2.0 KiB
TypeScript
import Honeybadger from '@honeybadger-io/js';
|
|
import { useToast } from '@metafam/ds';
|
|
import { useCallback } from 'react';
|
|
import { CombinedError } from 'urql';
|
|
|
|
import { CONFIG } from '../config';
|
|
|
|
export const errorHandler = (error: Error | CombinedError): void => {
|
|
// eslint-disable-next-line no-console
|
|
console.info(`In errorHandler: ${CONFIG.appEnv}`);
|
|
if (CONFIG.useHoneybadger) {
|
|
Honeybadger.notify(error);
|
|
} else {
|
|
console.error({ errorHandler: error });
|
|
}
|
|
};
|
|
|
|
type DebugErrorReports = {
|
|
debugErrorReports: () => void;
|
|
};
|
|
|
|
/**
|
|
* @description A hook to test our error reporting service. Currently [Honeybadger](https://app.honeybadger.io/projects/104891/faults?q=-is%3Aresolved+-is%3Aignored&sort=last_seen_desc)
|
|
* @returns `debugErrorReport` - Function to trigger an error to be reported
|
|
* based on `urlParams`: `debug=unhandledError` or `debug=handledError`.
|
|
*/
|
|
export const useDebugErrorReports = (): DebugErrorReports => {
|
|
const toast = useToast();
|
|
|
|
const debugErrorReports = useCallback(() => {
|
|
if (typeof window !== 'undefined') {
|
|
const query = window.location.search;
|
|
const urlParams = new URLSearchParams(query);
|
|
const throwUnhandledError = urlParams.get('debug') === 'unhandledError';
|
|
const throwHandledError = urlParams.get('debug') === 'handledError';
|
|
const errorMessage = urlParams.get('message');
|
|
|
|
if (throwUnhandledError) {
|
|
console.error(errorMessage ?? 'Debug Unhandled error');
|
|
throw new Error(errorMessage ?? 'Debug Unhandled error');
|
|
}
|
|
|
|
if (throwHandledError) {
|
|
try {
|
|
console.error(errorMessage ?? 'Debug Handled error');
|
|
throw new Error(errorMessage ?? 'Debug Handled Error');
|
|
} catch (err) {
|
|
const error = err as Error;
|
|
toast({
|
|
title: 'Error Debug',
|
|
description: `Throwing handled error: "${error.message}".`,
|
|
status: 'error',
|
|
isClosable: true,
|
|
});
|
|
errorHandler(error);
|
|
}
|
|
}
|
|
}
|
|
}, [toast]);
|
|
|
|
return { debugErrorReports };
|
|
};
|