Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified bun.lockb
Binary file not shown.
Binary file added favicon.ico
Binary file not shown.
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"type": "module",
"scripts": {
"prepare": "panda codegen",
"update-deps": "taze -I",
"update-deps": "taze -f -I",
"build": "remix vite:build",
"build-sourcemaps": "remix vite:build --config ./vite-sourcemaps.config.ts",
"upload-sourcemaps": "bun ./src/build/upload-sourcemaps.ts",
Expand All @@ -20,7 +20,7 @@
"sync-icons": "bun generateReadmeIcons -h 50"
},
"dependencies": {
"@effect/platform": "^0.71.6",
"@effect/platform": "^0.72.0",
"@remix-run/css-bundle": "^2.15.2",
"@remix-run/node": "^2.15.2",
"@remix-run/react": "^2.15.2",
Expand All @@ -29,9 +29,9 @@
"cacheable": "^1.8.6",
"comment-json": "^4.2.5",
"date-fns": "^4.1.0",
"effect": "^3.11.9",
"effect-cloudflare-r2-layer": "^1.0.38",
"effect-errors": "^1.7.45",
"effect": "^3.12.0",
"effect-cloudflare-r2-layer": "^1.0.43",
"effect-errors": "^1.8.4",
"framer-motion": "^11.15.0",
"highlight.js": "^11.11.0",
"isbot": "^5.1.18",
Expand All @@ -43,7 +43,7 @@
},
"devDependencies": {
"@biomejs/biome": "^1.9.4",
"@iconify/json": "^2.2.287",
"@iconify/json": "^2.2.288",
"@pandacss/dev": "^0.49.0",
"@remix-run/dev": "^2.15.2",
"@svgr/core": "^8.1.0",
Expand Down
20 changes: 13 additions & 7 deletions src/server/loader/logic/collect-error-details/index.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,28 @@
import { FetchHttpClient } from '@effect/platform';
import { NodeFileSystem } from '@effect/platform-node';
import { Effect, Layer, pipe } from 'effect';
import { captureErrors, prettyPrint } from 'effect-errors';
import { captureErrors, prettyPrintFromCapturedErrors } from 'effect-errors';
import type { Cause } from 'effect/Cause';

import { getErrorSourcesFromMapFile } from './logic/get-error-sources-from-map-file';

export const collectErrorDetails = <E>(cause: Cause<E>) =>
pipe(
Effect.gen(function* () {
const captured = yield* captureErrors(cause, {});

// Serverside logging
const errorsText = prettyPrint(cause, { stripCwd: false });
const errorsText = prettyPrintFromCapturedErrors(captured, {
stripCwd: true,
hideStackTrace: true,
reverseSpans: true,
});
console.error(errorsText);

const { errors } = yield* captureErrors(cause, {});

if (errors.every((e) => e.location !== undefined)) {
const errorsWithSources = yield* getErrorSourcesFromMapFile(errors);
if (captured.errors.every((e) => e.location !== undefined)) {
const errorsWithSources = yield* getErrorSourcesFromMapFile(
captured.errors,
);

return yield* Effect.succeed({
_tag: 'effect-post-mapped-errors' as const,
Expand All @@ -26,7 +32,7 @@ export const collectErrorDetails = <E>(cause: Cause<E>) =>

return yield* Effect.succeed({
_tag: 'effect-natively-mapped-errors' as const,
errors,
errors: captured.errors,
});
}),
Effect.scoped,
Expand Down
8 changes: 2 additions & 6 deletions src/server/remote-resources/get-map-file-from-r2.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { FetchHttpClient } from '@effect/platform';
import { Effect, Layer, pipe } from 'effect';
import { Effect, pipe } from 'effect';
import {
CloudflareR2StorageLayerLive,
FileStorageLayer,
Expand All @@ -22,9 +21,6 @@ export const getMapFileFromR2 = (branchName: string) =>
'remix-effect-errors',
`build/server/${branchName}/index.js.map`,
),
Effect.scoped,
Effect.provide(
Layer.mergeAll(CloudflareR2StorageLayerLive, FetchHttpClient.layer),
),
Effect.provide(CloudflareR2StorageLayerLive),
Effect.withSpan('get-map-file-from-r2', { attributes: { branchName } }),
);
Loading