Skip to content

Latest commit

 

History

History
192 lines (108 loc) · 5.47 KB

File metadata and controls

192 lines (108 loc) · 5.47 KB

andculturecode-javascript-coreDoSync

Class: DoSync <TResourceType, TReturnVal>

Type parameters

TResourceType

TReturnVal

Hierarchy

  • DoSync

Index

Constructors

Properties

Methods

Object literals

Constructors

Private constructor

+ new DoSync(workload: SyncWorkload‹TReturnVal›): DoSync

Defined in src/utilities/do-try.ts:120

Parameters:

Name Type
workload SyncWorkload‹TReturnVal›

Returns: DoSync

Properties

Private Optional catchHandler

catchHandler? : undefined | function

Defined in src/utilities/do-try.ts:115


Private Optional finallyHandler

finallyHandler? : FinallyHandler

Defined in src/utilities/do-try.ts:116


Private Readonly workload

workload: SyncWorkload‹TReturnVal›

Defined in src/utilities/do-try.ts:114

Methods

catch

catch(errorHandler: CatchResultHandler‹TResourceType›): DoSync‹TResourceType, TReturnVal›

Defined in src/utilities/do-try.ts:134

Add a catch handler to the DoSync call chain. If errors are in the shape of a {ResultRecord}, you will get a typed {ResultRecord} as the first parameter. Otherwise, if it's an unknown error or Javascript error, you'll get an {any} as the second parameter.

Parameters:

Name Type Description
errorHandler CatchResultHandler‹TResourceType› handle errors, either as a {ResultRecord} or {any}

Returns: DoSync‹TResourceType, TReturnVal›


execute

execute(): TReturnVal | undefined

Defined in src/utilities/do-try.ts:162

Execute the entire DoSync call chain. For the synchronous version, i.e. DoSync, you must manually call .execute() for the call chain to be executed.

Returns: TReturnVal | undefined

TReturnVal the value returned from the workload, or undefined if an error occurred.


finally

finally(finallyHandler: FinallyHandler): DoSync‹TResourceType, TReturnVal›

Defined in src/utilities/do-try.ts:185

Run some handler when the function completes, whether the catch() was hit or not.

Parameters:

Name Type
finallyHandler FinallyHandler

Returns: DoSync‹TResourceType, TReturnVal›

this


Static configure

configure(config: DoTryConfig): void

Defined in src/utilities/do-try.ts:153

Sets the global configuration for class {DySync}.

Parameters:

Name Type Description
config DoTryConfig the {DoTryConfig} object to set

Returns: void


Static try

try<TResourceType, TReturnVal>(workload: SyncWorkload‹TReturnVal›): DoSync‹TResourceType, TReturnVal›

Defined in src/utilities/do-try.ts:197

Static factory method for DoSync. Creates a new DoSync with the given workload.

Type parameters:

TResourceType

TReturnVal

Parameters:

Name Type Description
workload SyncWorkload‹TReturnVal›

Returns: DoSync‹TResourceType, TReturnVal›

Object literals

Static Private config

config: object

Defined in src/utilities/do-try.ts:118

defaultErrorHandler

defaultErrorHandler: undefined = undefined

Defined in src/utilities/do-try.ts:119