Skip to content

Commit

Permalink
add: additional error handeling on poster upload (#209)
Browse files Browse the repository at this point in the history
  • Loading branch information
fscorrupt authored Feb 4, 2025
2 parents 40a375b + 304ddd0 commit 3191a20
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 8 additions & 4 deletions Posterizarr.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ param (
[switch]$SyncEmby
)

$CurrentScriptVersion = "1.9.27"
$CurrentScriptVersion = "1.9.28"
$global:HeaderWritten = $false
$ProgressPreference = 'SilentlyContinue'

Expand Down Expand Up @@ -4143,9 +4143,13 @@ function UploadOtherMediaServerArtwork {
$UploadCount++
}
catch {
# Enhanced error handling
if ($_.Exception.Response -is [System.Net.Http.HttpResponseMessage]) {
$response = $_.Exception.Response.Content.ReadAsStringAsync().Result
if ($_.Exception.Response -is [System.Net.Http.HttpResponseMessage] -and $_.Exception.Response.Content) {
try {
$response = $_.Exception.Response.Content.ReadAsStringAsync().Result
}
catch {
$response = "Unable to read server response (content may be disposed)."
}
Write-Entry -Subtext "Failed to upload image. Server response: $response" -Path $global:ScriptRoot\Logs\Scriptlog.log -Color Red -log Error
}
else {
Expand Down
2 changes: 1 addition & 1 deletion Release.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.9.27
1.9.28

0 comments on commit 3191a20

Please sign in to comment.