Skip to content

Commit aaf0d29

Browse files
committed
Minor fixes
Wrap the environment setting in a try catch to avoid error if user does not have enough priveledges
1 parent 106e5e8 commit aaf0d29

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

cls/SourceControl/Git/Settings.cls

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,12 @@ Method %Save() As %Status
119119
} else {
120120
set @storage@("settings", "user", $username, "basicMode") = ..basicMode
121121
}
122+
try {
123+
do $SYSTEM.Version.SystemMode(..environmentName)
124+
} catch e {
125+
// no-op; user might not have privileges.
126+
}
122127

123-
do $SYSTEM.Version.SystemMode(..environmentName)
124128

125129

126130
// update value of basicUserMode to reflect the updated setting for basicMode
@@ -184,7 +188,6 @@ ClassMethod Configure() As %Boolean [ CodeMode = objectgenerator ]
184188
do %code.WriteLine(" set list(3) = ""LIVE""")
185189
do %code.WriteLine(" set list(4) = ""FAILOVER""")
186190
do %code.WriteLine(" set list(5) = """"")
187-
do %code.WriteLine(" set value = inst.environmentName")
188191
do %code.WriteLine(" set response = ##class(%Library.Prompt).GetArray("_promptQuoted_",.value,.list,,,,"_defaultPromptFlag_")")
189192
} else {
190193
do %code.WriteLine(" set response = ##class(%Library.Prompt).GetString("_promptQuoted_",.value,,,,"_defaultPromptFlag_")")

cls/SourceControl/Git/WebUIDriver.cls

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ ClassMethod HandleRequest(pagePath As %String, InternalName As %String = "", Out
2929
} elseif $extract(pagePath,6,*) = "remote" {
3030
set responseJSON = ..GetRemote()
3131
} elseif $extract(pagePath,6,*) = "environment" {
32-
set responseJSON = {
33-
"environment": (##class(SourceControl.Git.Utils).EnvironmentName())
34-
}
32+
set responseJSON = {
33+
"environment": (##class(SourceControl.Git.Utils).EnvironmentName())
34+
}
3535
} else {
3636
set %response.Status = ##class(%CSP.REST).#HTTP404NOTFOUND
3737
set responseJSON = {"error":("invalid URI: " _ pagePath)}

0 commit comments

Comments
 (0)