mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2025-09-16 21:05:33 -04:00
marginally better error logging
This commit is contained in:
@@ -27,7 +27,7 @@ export async function sendMessage(
|
|||||||
|
|
||||||
// backup to client-side validations just in case someone squeezes through without them
|
// backup to client-side validations just in case someone squeezes through without them
|
||||||
if (!validatedFields.success) {
|
if (!validatedFields.success) {
|
||||||
console.error(validatedFields.error.flatten());
|
console.error("[contact form] validation error:", validatedFields.error.flatten());
|
||||||
|
|
||||||
return {
|
return {
|
||||||
success: false,
|
success: false,
|
||||||
@@ -51,7 +51,7 @@ export async function sendMessage(
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (!turnstileResponse.ok) {
|
if (!turnstileResponse.ok) {
|
||||||
throw new Error(`Turnstile validation failed: ${turnstileResponse.status}`);
|
throw new Error(`[contact form] turnstile validation failed: ${turnstileResponse.status}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const turnstileData = await turnstileResponse?.json();
|
const turnstileData = await turnstileResponse?.json();
|
||||||
@@ -76,7 +76,7 @@ export async function sendMessage(
|
|||||||
|
|
||||||
return { success: true, message: "Thanks! You should hear from me soon.", payload: formData };
|
return { success: true, message: "Thanks! You should hear from me soon.", payload: formData };
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Contact form error:", error);
|
console.error("[contact form] fatal error:", error);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
success: false,
|
success: false,
|
||||||
|
@@ -19,7 +19,8 @@ const HitCounter = async ({ slug }: { slug: string }) => {
|
|||||||
// we have data!
|
// we have data!
|
||||||
return <span title={`${commaNumber(hits)} ${hits === 1 ? "view" : "views"}`}>{commaNumber(hits)}</span>;
|
return <span title={`${commaNumber(hits)} ${hits === 1 ? "view" : "views"}`}>{commaNumber(hits)}</span>;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error("[hit counter] fatal error:", error);
|
||||||
|
|
||||||
throw new Error();
|
throw new Error();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@@ -117,7 +117,7 @@ export default async function Page({ params }: { params: Promise<{ slug: string
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* only count hits on production site */}
|
{/* only count hits on production site */}
|
||||||
{process.env.NEXT_PUBLIC_VERCEL_ENV === "production" && (
|
{process.env.NEXT_PUBLIC_VERCEL_ENV !== "development" && process.env.NODE_ENV !== "development" ? (
|
||||||
<ErrorBoundary fallback={null}>
|
<ErrorBoundary fallback={null}>
|
||||||
<div
|
<div
|
||||||
className={styles.metaItem}
|
className={styles.metaItem}
|
||||||
@@ -133,7 +133,7 @@ export default async function Page({ params }: { params: Promise<{ slug: string
|
|||||||
</Suspense>
|
</Suspense>
|
||||||
</div>
|
</div>
|
||||||
</ErrorBoundary>
|
</ErrorBoundary>
|
||||||
)}
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h1 className={styles.title}>
|
<h1 className={styles.title}>
|
||||||
|
@@ -1,24 +1,25 @@
|
|||||||
|
/* eslint-disable import/no-anonymous-default-export */
|
||||||
|
|
||||||
import { FlatCompat } from "@eslint/eslintrc";
|
import { FlatCompat } from "@eslint/eslintrc";
|
||||||
import js from "@eslint/js";
|
import js from "@eslint/js";
|
||||||
import { fixupConfigRules } from "@eslint/compat";
|
import * as eslintPluginMdx from "eslint-plugin-mdx";
|
||||||
import prettierRecommended from "eslint-plugin-prettier/recommended";
|
import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended";
|
||||||
import customConfig from "@jakejarvis/eslint-config";
|
import eslintCustomConfig from "@jakejarvis/eslint-config";
|
||||||
import * as mdx from "eslint-plugin-mdx";
|
|
||||||
|
|
||||||
|
/** @type {import("@eslint/eslintrc").FlatCompat} */
|
||||||
const compat = new FlatCompat({
|
const compat = new FlatCompat({
|
||||||
baseDirectory: import.meta.dirname,
|
baseDirectory: import.meta.dirname,
|
||||||
|
recommendedConfig: js.configs.recommended,
|
||||||
});
|
});
|
||||||
|
|
||||||
// eslint-disable-next-line import/no-anonymous-default-export
|
/** @type {import("eslint").Linter.Config[]} */
|
||||||
export default [
|
export default [
|
||||||
{ ignores: ["README.md", ".next", ".vercel", "node_modules"] },
|
{ ignores: ["README.md", ".next", ".vercel", "node_modules"] },
|
||||||
js.configs.recommended,
|
...compat.config({
|
||||||
...customConfig,
|
extends: ["eslint:recommended", "next/core-web-vitals", "next/typescript"],
|
||||||
...fixupConfigRules(
|
}),
|
||||||
// https://github.com/vercel/next.js/issues/64114#issuecomment-2325268516
|
...eslintCustomConfig,
|
||||||
compat.extends("next/core-web-vitals", "next/typescript")
|
eslintPluginPrettierRecommended,
|
||||||
),
|
|
||||||
prettierRecommended,
|
|
||||||
{
|
{
|
||||||
rules: {
|
rules: {
|
||||||
"prettier/prettier": [
|
"prettier/prettier": [
|
||||||
@@ -38,7 +39,6 @@ export default [
|
|||||||
"@typescript-eslint/no-explicit-any": "warn",
|
"@typescript-eslint/no-explicit-any": "warn",
|
||||||
"react/no-unescaped-entities": "off",
|
"react/no-unescaped-entities": "off",
|
||||||
"react/jsx-boolean-value": "error",
|
"react/jsx-boolean-value": "error",
|
||||||
|
|
||||||
"react/jsx-wrap-multilines": [
|
"react/jsx-wrap-multilines": [
|
||||||
"error",
|
"error",
|
||||||
{
|
{
|
||||||
@@ -54,19 +54,14 @@ export default [
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
...mdx.flat,
|
...eslintPluginMdx.flat,
|
||||||
processor: mdx.createRemarkProcessor({
|
processor: eslintPluginMdx.createRemarkProcessor({
|
||||||
lintCodeBlocks: false,
|
lintCodeBlocks: false,
|
||||||
}),
|
}),
|
||||||
rules: {
|
rules: {
|
||||||
"mdx/remark": "warn",
|
"mdx/remark": "warn",
|
||||||
"mdx/code-blocks": "off",
|
"mdx/code-blocks": "off",
|
||||||
"react/jsx-no-undef": "off",
|
"react/jsx-no-undef": "off", // components are injected automatically from mdx-components.ts
|
||||||
"react/jsx-boolean-value": "off",
|
|
||||||
"react/no-unescaped-entities": "off",
|
|
||||||
// TODO: skip these correctly
|
|
||||||
"max-len": "off",
|
|
||||||
semi: "off",
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
@@ -69,7 +69,6 @@
|
|||||||
"zod": "^3.24.2"
|
"zod": "^3.24.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@eslint/compat": "^1.2.7",
|
|
||||||
"@eslint/eslintrc": "^3.3.0",
|
"@eslint/eslintrc": "^3.3.0",
|
||||||
"@eslint/js": "^9.21.0",
|
"@eslint/js": "^9.21.0",
|
||||||
"@jakejarvis/eslint-config": "^4.0.7",
|
"@jakejarvis/eslint-config": "^4.0.7",
|
||||||
@@ -84,6 +83,8 @@
|
|||||||
"eslint": "^9.21.0",
|
"eslint": "^9.21.0",
|
||||||
"eslint-config-next": "15.2.2-canary.1",
|
"eslint-config-next": "15.2.2-canary.1",
|
||||||
"eslint-config-prettier": "^10.0.2",
|
"eslint-config-prettier": "^10.0.2",
|
||||||
|
"eslint-plugin-import": "^2.31.0",
|
||||||
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
||||||
"eslint-plugin-mdx": "^3.1.5",
|
"eslint-plugin-mdx": "^3.1.5",
|
||||||
"eslint-plugin-prettier": "^5.2.3",
|
"eslint-plugin-prettier": "^5.2.3",
|
||||||
"eslint-plugin-react": "^7.37.4",
|
"eslint-plugin-react": "^7.37.4",
|
||||||
|
22
pnpm-lock.yaml
generated
22
pnpm-lock.yaml
generated
@@ -153,9 +153,6 @@ importers:
|
|||||||
specifier: ^3.24.2
|
specifier: ^3.24.2
|
||||||
version: 3.24.2
|
version: 3.24.2
|
||||||
devDependencies:
|
devDependencies:
|
||||||
'@eslint/compat':
|
|
||||||
specifier: ^1.2.7
|
|
||||||
version: 1.2.7(eslint@9.21.0)
|
|
||||||
'@eslint/eslintrc':
|
'@eslint/eslintrc':
|
||||||
specifier: ^3.3.0
|
specifier: ^3.3.0
|
||||||
version: 3.3.0
|
version: 3.3.0
|
||||||
@@ -198,6 +195,12 @@ importers:
|
|||||||
eslint-config-prettier:
|
eslint-config-prettier:
|
||||||
specifier: ^10.0.2
|
specifier: ^10.0.2
|
||||||
version: 10.0.2(eslint@9.21.0)
|
version: 10.0.2(eslint@9.21.0)
|
||||||
|
eslint-plugin-import:
|
||||||
|
specifier: ^2.31.0
|
||||||
|
version: 2.31.0(@typescript-eslint/parser@8.26.0(eslint@9.21.0)(typescript@5.8.2))(eslint-import-resolver-typescript@3.8.3)(eslint@9.21.0)
|
||||||
|
eslint-plugin-jsx-a11y:
|
||||||
|
specifier: ^6.10.2
|
||||||
|
version: 6.10.2(eslint@9.21.0)
|
||||||
eslint-plugin-mdx:
|
eslint-plugin-mdx:
|
||||||
specifier: ^3.1.5
|
specifier: ^3.1.5
|
||||||
version: 3.1.5(eslint@9.21.0)
|
version: 3.1.5(eslint@9.21.0)
|
||||||
@@ -414,15 +417,6 @@ packages:
|
|||||||
resolution: {integrity: sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ==}
|
resolution: {integrity: sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ==}
|
||||||
engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0}
|
engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0}
|
||||||
|
|
||||||
'@eslint/compat@1.2.7':
|
|
||||||
resolution: {integrity: sha512-xvv7hJE32yhegJ8xNAnb62ggiAwTYHBpUCWhRxEj/ksvgDJuSXfoDkBcRYaYNFiJ+jH0IE3K16hd+xXzhBgNbg==}
|
|
||||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
|
||||||
peerDependencies:
|
|
||||||
eslint: ^9.10.0
|
|
||||||
peerDependenciesMeta:
|
|
||||||
eslint:
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
'@eslint/config-array@0.19.2':
|
'@eslint/config-array@0.19.2':
|
||||||
resolution: {integrity: sha512-GNKqxfHG2ySmJOBSHg7LxeUx4xpuCoFjacmlCoYWEbaPXLwvfIjixRI12xCQZeULksQb23uiA8F40w5TojpV7w==}
|
resolution: {integrity: sha512-GNKqxfHG2ySmJOBSHg7LxeUx4xpuCoFjacmlCoYWEbaPXLwvfIjixRI12xCQZeULksQb23uiA8F40w5TojpV7w==}
|
||||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||||
@@ -3552,10 +3546,6 @@ snapshots:
|
|||||||
|
|
||||||
'@eslint-community/regexpp@4.12.1': {}
|
'@eslint-community/regexpp@4.12.1': {}
|
||||||
|
|
||||||
'@eslint/compat@1.2.7(eslint@9.21.0)':
|
|
||||||
optionalDependencies:
|
|
||||||
eslint: 9.21.0
|
|
||||||
|
|
||||||
'@eslint/config-array@0.19.2':
|
'@eslint/config-array@0.19.2':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@eslint/object-schema': 2.1.6
|
'@eslint/object-schema': 2.1.6
|
||||||
|
Reference in New Issue
Block a user