Page URL:
https://developer.sailpoint.com/docs/tools/sdk/powershell/error-handling
Description:
The current Error Handling documentation for the PowerShell SDK shows how to catch errors using a try/catch block and log the status code and error message. However, it only shows a generic catch block and does not include any example of how to handle specific HTTP status codes differently (e.g., 401 Unauthorized, 404 Not Found, 429 Too Many Requests).
Developers often need to handle these cases separately — for example, retrying on 429, redirecting on 404, or refreshing tokens on 401. Without an example in the docs, new SDK users have to figure this out on their own.
Suggested Improvement:
Add a code example that shows how to check specific status codes inside the catch block, like:
try {
Get-Transforms -Filters "id eq"
}
catch {
$statusCode = $_.Exception.Response.StatusCode.value__
switch ($statusCode) {
401 { Write-Host "Unauthorized - check your credentials." }
404 { Write-Host "Resource not found." }
429 { Write-Host "Rate limited - please wait before retrying." }
default { Write-Host "Unexpected error: $statusCode" }
}
}
This would make the error handling section more practical and helpful for developers integrating the SDK.
References:
Page URL:
https://developer.sailpoint.com/docs/tools/sdk/powershell/error-handling
Description:
The current Error Handling documentation for the PowerShell SDK shows how to catch errors using a try/catch block and log the status code and error message. However, it only shows a generic catch block and does not include any example of how to handle specific HTTP status codes differently (e.g., 401 Unauthorized, 404 Not Found, 429 Too Many Requests).
Developers often need to handle these cases separately — for example, retrying on 429, redirecting on 404, or refreshing tokens on 401. Without an example in the docs, new SDK users have to figure this out on their own.
Suggested Improvement:
Add a code example that shows how to check specific status codes inside the catch block, like:
This would make the error handling section more practical and helpful for developers integrating the SDK.
References: