andculturecode-javascript-core › DoSync
▪ TResourceType
▪ TReturnVal
- DoSync
+ new DoSync(workload: SyncWorkload‹TReturnVal›): DoSync
Defined in src/utilities/do-try.ts:120
Parameters:
| Name | Type |
|---|---|
workload |
SyncWorkload‹TReturnVal› |
Returns: DoSync
• catchHandler? : undefined | function
Defined in src/utilities/do-try.ts:115
• finallyHandler? : FinallyHandler
Defined in src/utilities/do-try.ts:116
• workload: SyncWorkload‹TReturnVal›
Defined in src/utilities/do-try.ts:114
▸ 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(): 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(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
▸ 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
▸ 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›
Defined in src/utilities/do-try.ts:118
• defaultErrorHandler: undefined = undefined
Defined in src/utilities/do-try.ts:119