Prettified Code!

This commit is contained in:
darrell-thobe-sp
2024-04-18 10:31:05 +00:00
committed by GitHub Action
parent f5b6aaf14f
commit 2cd5ccfc81
223 changed files with 40526 additions and 28073 deletions

View File

@@ -11,18 +11,17 @@ slug: /tools/ui-development-kit/error-handling
tags: ['UI', 'Error']
---
Ideally, everything in your custom UIs will work smoothly, but you will likely encounter errors at some point when you're implementing a page. If you provide an invalid filter or sorter, the list accounts endpoint will return a 400 error, for example.
You can handle this error by adding a `try catch` block to the server side of the accounts list page.
Ideally, everything in your custom UIs will work smoothly, but you will likely encounter errors at some point when you're implementing a page. If you provide an invalid filter or sorter, the list accounts endpoint will return a 400 error, for example. You can handle this error by adding a `try catch` block to the server side of the accounts list page.
If any of your backend calls result in a server error or bad request, you also want to handle those errors.
Read this guide to learn how to use the UI Development Kit to handle errors.
Read this guide to learn how to use the UI Development Kit to handle errors.
## 400 Bad Request
If you provide an invalid filter or sorter, the [List Accounts Endpoint](https://developer.sailpoint.com/docs/api/v3/list-accounts) returns a 400 error. This example awaits the response and doesn't exit the program when a 4xx level status is received. If a 4xx level status is received, the user is redirected to an error page.
Refer to this code block to learn how to implement error handling for invalid filters or sorters:
Refer to this code block to learn how to implement error handling for invalid filters or sorters:
```typescript
import {createConfiguration} from '$lib/sailpoint/sdk.js';
@@ -80,7 +79,7 @@ export const load = async ({url, locals}) => {
You can update the code block to handle more than just the 400 level statuses. You can see the highlighted code changes to handle any error response from the API call. You can send back an error to the user with the status, a detailed message, the details about the parameters used that caused the error, and the error response from the API.
Refer to this code block to learn how to implement error handling for other non-400 errors:
Refer to this code block to learn how to implement error handling for other non-400 errors:
```typescript
import {createConfiguration} from '$lib/sailpoint/sdk.js';
@@ -136,8 +135,8 @@ export const load = async ({url, locals}) => {
};
```
## Discuss
## Discuss
The most valuable resource for ISC developers is the SailPoint Developer Community itself, where ISC users and experts all over the world come together to ask questions and provide solutions.
The most valuable resource for ISC developers is the SailPoint Developer Community itself, where ISC users and experts all over the world come together to ask questions and provide solutions.
To learn more about the ISC UI Development Kit and discuss it with SailPoint Developer Community members, go to the [SailPoint Developer Community Forum](https://developer.sailpoint.com/discuss/c/identity-security-cloud/6).
To learn more about the ISC UI Development Kit and discuss it with SailPoint Developer Community members, go to the [SailPoint Developer Community Forum](https://developer.sailpoint.com/discuss/c/identity-security-cloud/6).