alacritty-theme-switch
Version:
CLI utility for switching Alacritty color themes
120 lines (119 loc) • 3.53 kB
JavaScript
/**
* Error thrown when a repository URL format is invalid.
*/
export class InvalidRepositoryUrlError extends Error {
constructor(url, options) {
super(`Invalid GitHub repository URL: ${url}. Expected format: https://github.com/owner/repo or git@github.com:owner/repo.git`, options);
Object.defineProperty(this, "_tag", {
enumerable: true,
configurable: true,
writable: true,
value: "InvalidRepositoryUrlError"
});
Object.defineProperty(this, "url", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
this.url = url;
}
}
/**
* Error thrown when a GitHub API request fails.
*/
export class GitHubApiError extends Error {
constructor(url, options) {
super(`GitHub API request failed: ${url}`, options);
Object.defineProperty(this, "_tag", {
enumerable: true,
configurable: true,
writable: true,
value: "GitHubApiError"
});
Object.defineProperty(this, "url", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
this.url = url;
}
}
/**
* Error thrown when downloading a file fails.
*/
export class FileDownloadError extends Error {
constructor(path, options) {
super(`Failed to download file: ${path}`, options);
Object.defineProperty(this, "_tag", {
enumerable: true,
configurable: true,
writable: true,
value: "FileDownloadError"
});
Object.defineProperty(this, "path", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
this.path = path;
}
}
/**
* Error thrown when writing a downloaded file to disk fails.
*/
export class FileWriteError extends Error {
constructor(path, options) {
super(`Failed to write file: ${path}`, options);
Object.defineProperty(this, "_tag", {
enumerable: true,
configurable: true,
writable: true,
value: "FileWriteError"
});
Object.defineProperty(this, "path", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
this.path = path;
}
}
/**
* Error thrown when a theme is not found in the repository.
*/
export class ThemeNotFoundInRepoError extends Error {
constructor(themePath, options) {
super(`Theme not found in repository: ${themePath}`, options);
Object.defineProperty(this, "_tag", {
enumerable: true,
configurable: true,
writable: true,
value: "ThemeNotFoundInRepoError"
});
Object.defineProperty(this, "themePath", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
this.themePath = themePath;
}
}
/**
* Error thrown when no license file is found in the repository.
*/
export class NoLicenseFileFoundError extends Error {
constructor(options) {
super(`No license file found in repository`, options);
Object.defineProperty(this, "_tag", {
enumerable: true,
configurable: true,
writable: true,
value: "NoLicenseFileFoundError"
});
}
}