Interface: AbortReason

Oracle® JavaScript Extension Toolkit (JET)
17.0.0

F92240-01

Since:
  • 17.0.0
Module:
  • ojabortreason

QuickNav

Fields

Description

The AbortReason interface defines the exception contract that will be provided when JET components abort fetch requests.


Usage

Signature:

interface AbortReason extends DOMException

Typescript Import Format
//To use this interface, import as below.
import {AbortReason} from "ojs/ojabortreason";

For additional information visit:


The AbortReason interface defines the exception contract that will be provided when JET components abort fetch requests.

Example

How to abort fetchByKeys

// abort on an AbortController instance will abort all requests that are associated
// with the signal from that abortController.
const abortController = new AbortController();
let keySet = new Set();
keySet.add(1001);
keySet.add(556);
// component passes AbortSignal as part of FetchByKeysParameters to fetchByKeys
// on dataProvider
try {
 let value = await dataprovider.fetchByKeys({keys: keySet, signal: abortController.signal});
} catch (err) {
 // if the data fetch has been aborted, retrieving data from the fetched result
 // will be rejected with DOMException named AbortError
 if (err.severity === 'info') {
   // if the data fetch has been aborted from a jet component as a performance concern, an AbortReason will be provided.
   console.log(err.message);
 }
}
// later when abort is desired, component can invoke abort() on the cached
// abort controller to abort any outstanding data retrieval it requested
// on asyncIterator.
if (abort_is_desired) {
  abortController.abort();
}

Fields

severity :'error'|'warn'|'log'|'info'|'none'

The level of severity of why the fetch was aborted.
Since:
  • 17.0.0