Home / File/ error.ts — astro Source File

error.ts — astro Source File

Architecture documentation for error.ts, a typescript file in the astro codebase. 5 imports, 0 dependents.

File typescript CoreAstro RenderingEngine 5 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  40343022_932a_3e00_df86_950e17dfc4f7["error.ts"]
  a4f2698c_5256_262a_ba7c_f72b51878d10["../core/app/types.js"]
  40343022_932a_3e00_df86_950e17dfc4f7 --> a4f2698c_5256_262a_ba7c_f72b51878d10
  0e18005f_823b_9864_a584_bf040da30d0c["../core/errors/dev/index.js"]
  40343022_932a_3e00_df86_950e17dfc4f7 --> 0e18005f_823b_9864_a584_bf040da30d0c
  d3861967_b647_84d2_ff48_15013353bd56["../core/logger/core.js"]
  40343022_932a_3e00_df86_950e17dfc4f7 --> d3861967_b647_84d2_ff48_15013353bd56
  8db17b08_b9e5_db7e_cd39_46be76c6d5ad["../core/messages.js"]
  40343022_932a_3e00_df86_950e17dfc4f7 --> 8db17b08_b9e5_db7e_cd39_46be76c6d5ad
  32f8c7d4_d66e_e0cf_b019_46ec3f2fea31["../core/module-loader/index.js"]
  40343022_932a_3e00_df86_950e17dfc4f7 --> 32f8c7d4_d66e_e0cf_b019_46ec3f2fea31
  style 40343022_932a_3e00_df86_950e17dfc4f7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import type { SSRManifest } from '../core/app/types.js';
import { collectErrorMetadata } from '../core/errors/dev/index.js';
import type { Logger } from '../core/logger/core.js';
import { formatErrorMessage } from '../core/messages.js';
import type { ModuleLoader } from '../core/module-loader/index.js';

export function recordServerError(
	loader: ModuleLoader,
	manifest: SSRManifest,
	logger: Logger,
	err: Error,
) {
	// This could be a runtime error from Vite's SSR module, so try to fix it here
	try {
		loader.fixStacktrace(err);
	} catch {}

	// This is our last line of defense regarding errors where we still might have some information about the request
	// Our error should already be complete, but let's try to add a bit more through some guesswork
	const errorWithMetadata = collectErrorMetadata(err, manifest.rootDir);

	logger.error(null, formatErrorMessage(errorWithMetadata, logger.level() === 'debug'));

	return {
		errorWithMetadata,
	};
}

Domain

Subdomains

Dependencies

  • ../core/app/types.js
  • ../core/errors/dev/index.js
  • ../core/logger/core.js
  • ../core/messages.js
  • ../core/module-loader/index.js

Frequently Asked Questions

What does error.ts do?
error.ts is a source file in the astro codebase, written in typescript. It belongs to the CoreAstro domain, RenderingEngine subdomain.
What functions are defined in error.ts?
error.ts defines 1 function(s): recordServerError.
What does error.ts depend on?
error.ts imports 5 module(s): ../core/app/types.js, ../core/errors/dev/index.js, ../core/logger/core.js, ../core/messages.js, ../core/module-loader/index.js.
Where is error.ts in the architecture?
error.ts is located at packages/astro/src/vite-plugin-astro-server/error.ts (domain: CoreAstro, subdomain: RenderingEngine, directory: packages/astro/src/vite-plugin-astro-server).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free