Skip to content

Commit

Permalink
Fixed: If the validation parsing has an error, don't throw but return…
Browse files Browse the repository at this point in the history
… false
  • Loading branch information
claudiospizzi committed May 1, 2020
1 parent 9f90ff7 commit d0c5347
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 9 deletions.
29 changes: 20 additions & 9 deletions Adb/Functions/Test-AdbItemValidation.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,28 @@ function Test-AdbItemValidation
}
catch
{
$errorMessage = $_.ErrorDetails.Message | ConvertFrom-Json | Select-Object -ExpandProperty 'error'

if ([System.String]::IsNullOrEmpty($errorMessage))
try
{
$errorMessage = $_.ErrorDetails.Message
}
$errorMessage = $_.ErrorDetails.Message | ConvertFrom-Json | Select-Object -ExpandProperty 'error'

$result = [PSCustomObject] @{
Result = $false
Message = $errorMessage
Violations = $errorMessage.Split(([System.String[]] ', '), [System.StringSplitOptions]::None)
if ([System.String]::IsNullOrEmpty($errorMessage))
{
$errorMessage = $_.ErrorDetails.Message
}

$result = [PSCustomObject] @{
Result = $false
Message = $errorMessage
Violations = $errorMessage.Split(([System.String[]] ', '), [System.StringSplitOptions]::None)
}
}
catch
{
$result = [PSCustomObject] @{
Result = $false
Message = "Internal Item Validation Error: $_"
Violations = "Internal Item Validation Error: $_"
}
}
}

Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
The format is mainly based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## Unreleased

* Fixed: If the validation parsing has an error, don't throw but return false

## 1.4.0 - 2020-04-09

* Added: Command to add and remove templates from the adb item
Expand Down

0 comments on commit d0c5347

Please sign in to comment.