aboutsummaryrefslogtreecommitdiffstats
path: root/models/packages/package.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/packages/package.go')
-rw-r--r--models/packages/package.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/models/packages/package.go b/models/packages/package.go
index 417d62d199..c12f345f0e 100644
--- a/models/packages/package.go
+++ b/models/packages/package.go
@@ -301,6 +301,21 @@ func FindUnreferencedPackages(ctx context.Context) ([]*Package, error) {
Find(&ps)
}
+// ErrUserOwnPackages notifies that the user (still) owns the packages.
+type ErrUserOwnPackages struct {
+ UID int64
+}
+
+// IsErrUserOwnPackages checks if an error is an ErrUserOwnPackages.
+func IsErrUserOwnPackages(err error) bool {
+ _, ok := err.(ErrUserOwnPackages)
+ return ok
+}
+
+func (err ErrUserOwnPackages) Error() string {
+ return fmt.Sprintf("user still has ownership of packages [uid: %d]", err.UID)
+}
+
// HasOwnerPackages tests if a user/org has accessible packages
func HasOwnerPackages(ctx context.Context, ownerID int64) (bool, error) {
return db.GetEngine(ctx).