mirror of
https://github.com/LukeHagar/developer.sailpoint.com.git
synced 2025-12-09 12:27:47 +00:00
Edits
This commit is contained in:
@@ -11,11 +11,18 @@ slug: /tools/ui-development-kit/error-handling
|
||||
tags: ['UI', 'Error']
|
||||
---
|
||||
|
||||
If any of your backend calls result in a server error or bad request you'll want to handle those errors.
|
||||
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.
|
||||
|
||||
## 400 bad request
|
||||
If any of your backend calls result in a server error or bad request, you also want to handle those errors.
|
||||
|
||||
If you provide an invalid filter or sorter, the list accounts endpoint will return a 400 error. This example awaits the response and does not exit the program when a 4xx level status is received. If a 4xx level status is received then the user will be redirected to an error page.
|
||||
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:
|
||||
|
||||
```typescript
|
||||
import {createConfiguration} from '$lib/sailpoint/sdk.js';
|
||||
@@ -69,10 +76,12 @@ export const load = async ({url, locals}) => {
|
||||
};
|
||||
```
|
||||
|
||||
## 500 server issues
|
||||
## 500 Server Issues
|
||||
|
||||
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:
|
||||
|
||||
```typescript
|
||||
import {createConfiguration} from '$lib/sailpoint/sdk.js';
|
||||
import {getFilters, getLimit, getPage, getSorters} from '$lib/Utils.js';
|
||||
@@ -126,3 +135,9 @@ export const load = async ({url, locals}) => {
|
||||
return {accountData, totalCount, params: {page, limit, sorters, filters}};
|
||||
};
|
||||
```
|
||||
|
||||
## 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.
|
||||
|
||||
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).
|
||||
Reference in New Issue
Block a user