1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-01-19 00:09:16 +08:00

fix: Optimize image deletion error return (#7602)

Refs #7068
This commit is contained in:
ssongliu 2024-12-30 17:17:49 +08:00 committed by GitHub
parent 667ee5256e
commit fc401ffd8f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 12 additions and 4 deletions

View File

@ -439,6 +439,9 @@ func (u *ImageService) ImageRemove(req dto.BatchDelete) error {
}
return buserr.WithDetail(constant.ErrInUsed, id, nil)
}
if strings.Contains(err.Error(), "image has dependent") {
return buserr.New(constant.ErrObjectBeDependent)
}
return err
}
}

View File

@ -128,6 +128,7 @@ var (
var (
ErrInUsed = "ErrInUsed"
ErrObjectInUsed = "ErrObjectInUsed"
ErrObjectBeDependent = "ErrObjectBeDependent"
ErrPortRules = "ErrPortRules"
ErrPgImagePull = "ErrPgImagePull"
)

View File

@ -146,6 +146,7 @@ ErrTypeOfRedis: "The recovery file type does not match the current persistence m
#container
ErrInUsed: "{{ .detail }} is in use and can't be deleted"
ErrObjectInUsed: "This object is in use and can't be deleted"
ErrObjectBeDependent: "This image is dependent on other images and can't be deleted"
ErrPortRules: "The number of ports does not match, please re-enter!"
ErrPgImagePull: "Image pull timeout. Please configure image acceleration or manually pull the postgres:16.0-alpine image and try again"

View File

@ -146,6 +146,7 @@ ErrTypeOfRedis: "Тип восстановленного файла не соо
#container
ErrInUsed: "{{ .detail }} используется и не может быть удален"
ErrObjectInUsed: "Этот объект используется и не может быть удален"
ErrObjectBeDependent: "Этот образ зависит от других образов и не может быть удален"
ErrPortRules: "Количество портов не совпадает, пожалуйста, введите заново!"
ErrPgImagePull: "Тайм-аут загрузки образа. Пожалуйста, настройте ускорение загрузки образа или вручную загрузите образ postgres:16.0-alpine и попробуйте снова"

View File

@ -146,6 +146,7 @@ ErrTypeOfRedis: "恢復文件類型與目前持久化方式不匹配,請修改
#container
ErrInUsed: "{{ .detail }} 正被使用,無法刪除"
ErrObjectInUsed: "該對象正被使用,無法刪除"
ErrObjectBeDependent: "該鏡像依賴於其他鏡像,無法刪除"
ErrPortRules: "埠數目不匹配,請重新輸入!"
ErrPgImagePull: "鏡像拉取超時,請配置鏡像加速或手動拉取 postgres:16.0-alpine 鏡像後重試"

View File

@ -146,6 +146,7 @@ ErrTypeOfRedis: "恢复文件类型与当前持久化方式不符,请修改后
#container
ErrInUsed: "{{ .detail }} 正被使用,无法删除"
ErrObjectInUsed: "该对象正被使用,无法删除"
ErrObjectBeDependent: "该镜像依赖于其他镜像,无法删除"
ErrPortRules: "端口数目不匹配,请重新输入!"
ErrPgImagePull: "镜像拉取超时,请配置镜像加速或手动拉取 postgres:16.0-alpine 镜像后重试"