Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change PublishModule to return error status instead of boolean #697

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- #678 Only update comment-flagged part of the language extension, allowing users to keep their custom code when upgrading
- #680, #683 Always export static files (README.md, LICENSE, requirements.txt, CHANGELOG.md) if existent

### Security
- #697 When publishing modules, will get an status with error message (instead of just a boolean) in case of failures.

## [0.9.1] - 2024-12-18

### Added
Expand Down
2 changes: 1 addition & 1 deletion src/cls/IPM/Lifecycle/Base.cls
Original file line number Diff line number Diff line change
Expand Up @@ -1403,7 +1403,7 @@ Method %Publish(ByRef pParams) As %Status
}


Do tPublishClient.PublishModule(tModule)
$$$ThrowOnError(tPublishClient.PublishModule(tModule))


// May need to update the version of the currently-installed module.
Expand Down
2 changes: 1 addition & 1 deletion src/cls/IPM/Repo/IPublishService.cls
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Class %IPM.Repo.IPublishService [ Abstract ]
{

Method PublishModule(pModule As %IPM.Repo.Remote.ModuleInfo) As %Boolean [ Abstract ]
Method PublishModule(pModule As %IPM.Repo.Remote.ModuleInfo) As %Status [ Abstract ]
{
}

Expand Down
12 changes: 8 additions & 4 deletions src/cls/IPM/Repo/Remote/PublishService.cls
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
Class %IPM.Repo.Remote.PublishService Extends (%IPM.Repo.Remote.PackageService, %IPM.Repo.IPublishService)
{

Method PublishModule(pModule As %IPM.Repo.Remote.ModuleInfo) As %Boolean
Method PublishModule(pModule As %IPM.Repo.Remote.ModuleInfo) As %Status
{
Quit ..Publish(pModule)
Try {
Do ..Publish(pModule)
} Catch Ex {
Return Ex.AsStatus()
}
Return $$$OK
}

Method Publish(pModule As %IPM.Repo.Remote.ModuleInfo) As %Boolean
Method Publish(pModule As %IPM.Repo.Remote.ModuleInfo)
{
If ((..Username="") || (..Password="")) && (..Token="") {
$$$ThrowStatus($$$ERROR($$$GeneralError, "Publishing module, authorization required."))
Expand All @@ -28,7 +33,6 @@ Method Publish(pModule As %IPM.Repo.Remote.ModuleInfo) As %Boolean
$$$ThrowStatus($$$ERROR($$$GeneralError, tMessage))
}
}
Return 1
}

Method CheckUnpublishEnabled(packageName As %String, packageVersion As %String) As %Boolean
Expand Down
Loading