@notabene/javascript-sdk
Advanced tools
Comparing version 1.22.0 to 1.23.0
@@ -11,3 +11,3 @@ { | ||
"license": "MIT", | ||
"version": "1.22.0", | ||
"version": "1.23.0", | ||
"main": "dist/index.js", | ||
@@ -14,0 +14,0 @@ "packageManager": "yarn@3.2.2", |
@@ -18,2 +18,10 @@ <div align="center"> | ||
- [Installation](#installation) | ||
- [Usage](#usage) | ||
- [Supported asset formats](#supported-asset-formats) | ||
- [Re-rendering](#re-rendering) | ||
- [Error handling](#error-handling) | ||
- [Customization](#customization) | ||
- [License](#license) | ||
## Installation | ||
@@ -80,3 +88,3 @@ | ||
###Supported asset formats | ||
### Supported asset formats | ||
@@ -117,2 +125,40 @@ - `USDC` the simple asset code passed as a `string`, in case different chain (polygon) -> `USDC-POLY` | ||
--- | ||
### Error handling | ||
If any error occurs, the `onError` function from the Notabene instance will be triggered. The `error` passed as argument contains a `data` property that has the following type `ErrorData`. | ||
> ⚠️ **Note**: These errors are mainly used for debugging internal issues while implementing the widget. They are not meant to be shown directly to the end user. | ||
```js | ||
type ErrorData = { | ||
title: string; | ||
detail: string; | ||
code: number; | ||
type: string; | ||
}; | ||
const notabene = new Notabene({ | ||
..., | ||
onError: (err) => { | ||
const errorData = err.data; | ||
// Do something | ||
}, | ||
}); | ||
``` | ||
**Notabene Internal Errors** | ||
Type | Code | Title | Detail | ||
-- | -- | -- | -- | ||
`BAD_REQUEST` | `400` | `Bad Request` | `NotabeneBadRequest: ...` | ||
`TRANSACTION_INVALID` | `400` | `Transaction Invalid` | `NotabeneTransactionInvalid: ...` | ||
`TOKEN_INVALID` | `401` | `Token Invalid` | `NotabeneTokenInvalid: ...` | ||
`ASSET_NOT_SUPPORTED` | `404` | `Asset Not Supported` | `NotabeneAssetNotSupported: ...` | ||
`SERVICE_UNAVAILABLE` | `500` | `Service Unavailable` | `NotabeneServiceUnavailable: ...` | ||
`WALLET_CONNECTED_FAILED` | `500` | `Wallet Connection Failed` | `NotabeneWalletConnectionFailed: ...` | ||
`WALLET_NOT_SUPPORTED` | `501` | `Wallet Not Supported` | `NotabeneWalletNotSupported: ...` | ||
## Customization | ||
@@ -119,0 +165,0 @@ |
Sorry, the diff of this file is not supported yet
161555
331