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 CoreMiddleware 1 imports 6 functions

Entity Profile

Dependency Diagram

graph LR
  7883139a_8aae_09d4_83e3_9bd7603e7403["errors.ts"]
  10250468_0e83_bd69_43e9_3bcef2294a91["piccolore"]
  7883139a_8aae_09d4_83e3_9bd7603e7403 --> 10250468_0e83_bd69_43e9_3bcef2294a91
  style 7883139a_8aae_09d4_83e3_9bd7603e7403 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import colors from 'piccolore';

export const MISSING_EXECUTE_PATH_ERROR = `${colors.red(
	'▶ No file path provided.',
)} Provide a path by running ${colors.cyan('astro db execute <path>')}\n`;

export const RENAME_TABLE_ERROR = (oldTable: string, newTable: string) => {
	return (
		colors.red('\u25B6 Potential table rename detected: ' + oldTable + ' -> ' + newTable) +
		`
  You cannot add and remove tables in the same schema update batch.

  1. Use "deprecated: true" to deprecate a table before renaming.
  2. Use "--force-reset" to ignore this warning and reset the database (deleting all of your data).

	Visit https://docs.astro.build/en/guides/astro-db/#renaming-tables to learn more.`
	);
};

export const RENAME_COLUMN_ERROR = (oldSelector: string, newSelector: string) => {
	return (
		colors.red('▶ Potential column rename detected: ' + oldSelector + ', ' + newSelector) +
		`\n  You cannot add and remove columns in the same table.` +
		`\n  To resolve, add a 'deprecated: true' flag to '${oldSelector}' instead.`
	);
};

export const FILE_NOT_FOUND_ERROR = (path: string) =>
	`${colors.red('▶ File not found:')} ${colors.bold(path)}\n`;

export const SHELL_QUERY_MISSING_ERROR = `${colors.red(
	'▶ Please provide a query to execute using the --query flag.',
)}\n`;

export const EXEC_ERROR = (error: string) => {
	return `${colors.red(`Error while executing file:`)}\n\n${error}`;
};

export const EXEC_DEFAULT_EXPORT_ERROR = (fileName: string) => {
	return EXEC_ERROR(`Missing default function export in ${colors.bold(fileName)}`);
};

export const INTEGRATION_TABLE_CONFLICT_ERROR = (
	integrationName: string,
	tableName: string,
	isUserConflict: boolean,
) => {
	return colors.red('▶ Conflicting table name in integration ' + colors.bold(integrationName)) +
		isUserConflict
		? `\n  A user-defined table named ${colors.bold(tableName)} already exists`
		: `\n  Another integration already added a table named ${colors.bold(tableName)}`;
};

Domain

Subdomains

Dependencies

  • piccolore

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, CoreMiddleware subdomain.
What functions are defined in errors.ts?
errors.ts defines 6 function(s): EXEC_DEFAULT_EXPORT_ERROR, EXEC_ERROR, FILE_NOT_FOUND_ERROR, INTEGRATION_TABLE_CONFLICT_ERROR, RENAME_COLUMN_ERROR, RENAME_TABLE_ERROR.
What does errors.ts depend on?
errors.ts imports 1 module(s): piccolore.
Where is errors.ts in the architecture?
errors.ts is located at packages/db/src/core/errors.ts (domain: CoreAstro, subdomain: CoreMiddleware, directory: packages/db/src/core).

Analyze Your Own Codebase

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

Try Supermodel Free