Refactor configuration errors (#2105)

Refactor the existing classes of configuration errors into their own file; consolidate the place we check for configuration errors into `codeql.ts`, where the actual command invocations happen.

Also, rename the `UserError` type to `ConfigurationError` to standardize on a single term.
This commit is contained in:
Angela P Wen 2024-02-08 09:20:03 -08:00 committed by GitHub
parent fc9f9e5ef9
commit 1515e2bb20
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
54 changed files with 654 additions and 502 deletions

View file

@ -1,4 +1,4 @@
import { UserError } from "./util";
import { ConfigurationError } from "./util";
// A repository name with owner, parsed into its two parts
export interface RepositoryNwo {
@ -9,7 +9,7 @@ export interface RepositoryNwo {
export function parseRepositoryNwo(input: string): RepositoryNwo {
const parts = input.split("/");
if (parts.length !== 2) {
throw new UserError(`"${input}" is not a valid repository name`);
throw new ConfigurationError(`"${input}" is not a valid repository name`);
}
return {
owner: parts[0],