Home / File/ errors.ts — astro Source File

errors.ts — astro Source File

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

File typescript CoreAstro RenderingEngine 1 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  a8063e25_3885_a254_cf52_6348a01798bd["errors.ts"]
  cc1161ce_d4d2_0bb4_bc6e_039c7a3d707c["./validators.js"]
  a8063e25_3885_a254_cf52_6348a01798bd --> cc1161ce_d4d2_0bb4_bc6e_039c7a3d707c
  style a8063e25_3885_a254_cf52_6348a01798bd fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import type { ValidationResultErrors } from './validators.js';

export interface InvalidVariable {
	key: string;
	type: string;
	errors: ValidationResultErrors;
}

export function invalidVariablesToError(invalid: Array<InvalidVariable>) {
	const _errors: Array<string> = [];
	for (const { key, type, errors } of invalid) {
		if (errors[0] === 'missing') {
			_errors.push(`${key} is missing`);
		} else if (errors[0] === 'type') {
			_errors.push(`${key}'s type is invalid, expected: ${type}`);
		} else {
			// constraints
			_errors.push(`The following constraints for ${key} are not met: ${errors.join(', ')}`);
		}
	}
	return _errors;
}

Domain

Subdomains

Dependencies

  • ./validators.js

Frequently Asked Questions

What does errors.ts do?
errors.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 errors.ts?
errors.ts defines 1 function(s): invalidVariablesToError.
What does errors.ts depend on?
errors.ts imports 1 module(s): ./validators.js.
Where is errors.ts in the architecture?
errors.ts is located at packages/astro/src/env/errors.ts (domain: CoreAstro, subdomain: RenderingEngine, directory: packages/astro/src/env).

Analyze Your Own Codebase

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

Try Supermodel Free