Skip to content

Commit

Permalink
Add a throw, if challenge does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Glatzer committed Feb 11, 2021
1 parent 66aa840 commit 72a5180
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 11 deletions.
2 changes: 1 addition & 1 deletion ACME-PS/ACME-PS.psd1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@{
RootModule = 'ACME-PS.psm1'
ModuleVersion = '1.3.2'
ModuleVersion = '1.3.3'
GUID = '2DBF7E3F-F830-403A-9300-78A11C7CD00C'

CompatiblePSEditions = @("Core", "Desktop")
Expand Down
12 changes: 8 additions & 4 deletions ACME-PS/functions/Challenge/Get-Challenge.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,15 @@ function Get-Challenge {
)

process {
$challange = $Authorization.Challenges | Where-Object { $_.Type -eq $Type } | Select-Object -First 1
if(-not $challange.Data) {
$challange | Initialize-Challenge $State
$challenge = $Authorization.Challenges | Where-Object { $_.Type -eq $Type } | Select-Object -First 1
if(-not $challenge) {
throw "Could not find challenge of Type $Type";
}

return $challange;
if(-not $challenge.Data) {
$challenge | Initialize-Challenge $State
}

return $challenge;
}
}
4 changes: 2 additions & 2 deletions dist/ACME-PS/ACME-PS.psd1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@{
RootModule = 'ACME-PS.psm1'
ModuleVersion = '1.3.2'
ModuleVersion = '1.3.3'
GUID = '2DBF7E3F-F830-403A-9300-78A11C7CD00C'

CompatiblePSEditions = @("Core", "Desktop")
Expand Down Expand Up @@ -85,7 +85,7 @@
ReleaseNotes = 'Please see the release notes from the release distribution page: https://github.com/PKISharp/ACME-PS/releases'

# Prerelase
# Prerelease = 'beta3'
# Prerelease = 'beta'
} # End of PSData hashtable

} # End of PrivateData hashtable
Expand Down
12 changes: 8 additions & 4 deletions dist/ACME-PS/ACME-PS.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -2659,12 +2659,16 @@ function Get-Challenge {
)

process {
$challange = $Authorization.Challenges | Where-Object { $_.Type -eq $Type } | Select-Object -First 1
if(-not $challange.Data) {
$challange | Initialize-Challenge $State
$challenge = $Authorization.Challenges | Where-Object { $_.Type -eq $Type } | Select-Object -First 1
if(-not $challenge) {
throw "Could not find challenge of Type $Type";
}

return $challange;
if(-not $challenge.Data) {
$challenge | Initialize-Challenge $State
}

return $challenge;
}
}

Expand Down

0 comments on commit 72a5180

Please sign in to comment.