Skip to content

[Docs] Error Handling page for PowerShell SDK is missing example for handling specific HTTP status codes (404, 401, 429) #1115

@Rameshv157

Description

@Rameshv157

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:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions