Home / File/ errors.js — svelte Source File

errors.js — svelte Source File

Architecture documentation for errors.js, a javascript file in the svelte codebase. 2 imports, 55 dependents.

File javascript Compiler Transformer 2 imports 55 dependents 179 functions 1 classes

Entity Profile

Dependency Diagram

graph LR
  495501a4_a342_6a4d_ac11_e3e2fee8b218["errors.js"]
  266f0f82_b1c9_08bb_80b9_55a66e7d3dba["compile_diagnostic.js"]
  495501a4_a342_6a4d_ac11_e3e2fee8b218 --> 266f0f82_b1c9_08bb_80b9_55a66e7d3dba
  fca2e303_5d6d_304a_d0fc_14ab13a1ecb7["CompileDiagnostic"]
  495501a4_a342_6a4d_ac11_e3e2fee8b218 --> fca2e303_5d6d_304a_d0fc_14ab13a1ecb7
  67d7170b_725b_33cc_868d_fad6ed435252["index.js"]
  67d7170b_725b_33cc_868d_fad6ed435252 --> 495501a4_a342_6a4d_ac11_e3e2fee8b218
  caefc1b2_dc4c_2cff_4013_e8ded13e7974["context.js"]
  caefc1b2_dc4c_2cff_4013_e8ded13e7974 --> 495501a4_a342_6a4d_ac11_e3e2fee8b218
  8b705104_0cb9_c5c8_5bed_6dcfe73592d3["expression.js"]
  8b705104_0cb9_c5c8_5bed_6dcfe73592d3 --> 495501a4_a342_6a4d_ac11_e3e2fee8b218
  09b07d2e_2631_ce6a_e899_0be23871c668["options.js"]
  09b07d2e_2631_ce6a_e899_0be23871c668 --> 495501a4_a342_6a4d_ac11_e3e2fee8b218
  90aa5201_1990_23b6_f05a_1ff5d9b22b14["script.js"]
  90aa5201_1990_23b6_f05a_1ff5d9b22b14 --> 495501a4_a342_6a4d_ac11_e3e2fee8b218
  251e2338_f8b8_69b4_b2e5_29ee7decbfa6["style.js"]
  251e2338_f8b8_69b4_b2e5_29ee7decbfa6 --> 495501a4_a342_6a4d_ac11_e3e2fee8b218
  0e67864d_62c6_024e_3588_da959afe5b23["remove_typescript_nodes.js"]
  0e67864d_62c6_024e_3588_da959afe5b23 --> 495501a4_a342_6a4d_ac11_e3e2fee8b218
  206889ff_1f9f_b6c1_d530_059d001e1cf4["element.js"]
  206889ff_1f9f_b6c1_d530_059d001e1cf4 --> 495501a4_a342_6a4d_ac11_e3e2fee8b218
  367a364a_2912_a1aa_b2e1_d97a82783c38["tag.js"]
  367a364a_2912_a1aa_b2e1_d97a82783c38 --> 495501a4_a342_6a4d_ac11_e3e2fee8b218
  0d221a90_b1cc_5826_235e_98f5216d6400["bracket.js"]
  0d221a90_b1cc_5826_235e_98f5216d6400 --> 495501a4_a342_6a4d_ac11_e3e2fee8b218
  ca006f7f_f554_f529_8a19_abaaa45dda8d["css-analyze.js"]
  ca006f7f_f554_f529_8a19_abaaa45dda8d --> 495501a4_a342_6a4d_ac11_e3e2fee8b218
  4aa8a188_84d4_0274_ed83_cac0ab1d3572["index.js"]
  4aa8a188_84d4_0274_ed83_cac0ab1d3572 --> 495501a4_a342_6a4d_ac11_e3e2fee8b218
  style 495501a4_a342_6a4d_ac11_e3e2fee8b218 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

/* This file is generated by scripts/process-messages/index.js. Do not edit! */

import { CompileDiagnostic } from './utils/compile_diagnostic.js';

/** @typedef {{ start?: number, end?: number }} NodeLike */
class InternalCompileError extends Error {
	message = ''; // ensure this property is enumerable
	#diagnostic;

	/**
	 * @param {string} code
	 * @param {string} message
	 * @param {[number, number] | undefined} position
	 */
	constructor(code, message, position) {
		super(message);
		this.stack = ''; // avoid unnecessary noise; don't set it as a class property or it becomes enumerable

		// We want to extend from Error so that various bundler plugins properly handle it.
		// But we also want to share the same object shape with that of warnings, therefore
		// we create an instance of the shared class an copy over its properties.
		this.#diagnostic = new CompileDiagnostic(code, message, position);

		Object.assign(this, this.#diagnostic);
		this.name = 'CompileError';
	}

	toString() {
		return this.#diagnostic.toString();
	}

	toJSON() {
		return this.#diagnostic.toJSON();
	}
}

/**
 * @param {null | number | NodeLike} node
 * @param {string} code
 * @param {string} message
 * @returns {never}
 */
function e(node, code, message) {
	const start = typeof node === 'number' ? node : node?.start;
	const end = typeof node === 'number' ? node : node?.end;

	throw new InternalCompileError(code, message, start !== undefined ? [start, end ?? start] : undefined);
}

/**
 * Invalid compiler option: %details%
 * @param {null | number | NodeLike} node
 * @param {string} details
 * @returns {never}
 */
export function options_invalid_value(node, details) {
	e(node, 'options_invalid_value', `Invalid compiler option: ${details}\nhttps://svelte.dev/e/options_invalid_value`);
}

/**
// ... (1659 more lines)

Domain

Subdomains

Functions

Imported By

Frequently Asked Questions

What does errors.js do?
errors.js is a source file in the svelte codebase, written in javascript. It belongs to the Compiler domain, Transformer subdomain.
What functions are defined in errors.js?
errors.js defines 179 function(s): animation_duplicate, animation_invalid_placement, animation_missing_key, attribute_contenteditable_dynamic, attribute_contenteditable_missing, attribute_duplicate, attribute_empty_shorthand, attribute_invalid_event_handler, attribute_invalid_multiple, attribute_invalid_name, and 169 more.
What does errors.js depend on?
errors.js imports 2 module(s): CompileDiagnostic, compile_diagnostic.js.
What files import errors.js?
errors.js is imported by 55 file(s): AnimateDirective.js, AttachTag.js, AwaitBlock.js, AwaitExpression.js, BindDirective.js, CallExpression.js, ClassBody.js, ConstTag.js, and 47 more.
Where is errors.js in the architecture?
errors.js is located at packages/svelte/src/compiler/errors.js (domain: Compiler, subdomain: Transformer, directory: packages/svelte/src/compiler).

Analyze Your Own Codebase

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

Try Supermodel Free