Skip to content

Commit

Permalink
Check if pkg name is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
hansott committed Nov 28, 2024
1 parent 9329848 commit ff82e02
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion library/agent/hooks/Package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ export class Package {
private versions: VersionedPackage[] = [];

constructor(private packageName: PackageName) {
if (!this.packageName) {
this.assertValidPackageName(this.packageName);
}

private assertValidPackageName(name: string) {
if (!name) {
throw new Error("Package name is required");
}
}
Expand All @@ -23,6 +27,7 @@ export class Package {
}

setName(name: string) {
this.assertValidPackageName(name);
this.packageName = name;
}

Expand Down

0 comments on commit ff82e02

Please sign in to comment.