Skip to content

Commit

Permalink
Merge pull request #697 from intersystems/main-fix-publish-doesnt-sho…
Browse files Browse the repository at this point in the history
…w-error

Change `PublishModule` to return error status instead of boolean
  • Loading branch information
isc-shuliu authored Jan 13, 2025
2 parents c32ffa5 + 75e9b5c commit 672dc9f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
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

0 comments on commit 672dc9f

Please sign in to comment.