Skip to content

Commit 5b53f2c

Browse files
author
Mat Jones
committed
code cleanup per code review
1 parent d5a28dd commit 5b53f2c

4 files changed

Lines changed: 29 additions & 14 deletions

File tree

src/tests/factories/result-error-record-factory.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ResultErrorRecord } from "../..//view-models/result-error-record";
1+
import { ResultErrorRecord } from "../../view-models/result-error-record";
22
import { Factory } from "rosie";
33
import { FactoryType } from "./factory-type";
44

src/types/do-try-types.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { ResultRecord } from "../view-models/result-record";
2+
3+
// -----------------------------------------------------------------------------------------
4+
// #region Types
5+
// -----------------------------------------------------------------------------------------
6+
7+
type AsyncWorkload<T> = () => Promise<T>;
8+
type SyncWorkload<T> = () => T;
9+
type CatchHandler<T> = (result?: ResultRecord<T>, error?: any) => void;
10+
type FinallyHandler = () => void;
11+
12+
// #endregion Types
13+
14+
// -----------------------------------------------------------------------------------------
15+
// #region Exports
16+
// -----------------------------------------------------------------------------------------
17+
18+
export { AsyncWorkload, SyncWorkload, CatchHandler, FinallyHandler };
19+
20+
// #endregion Exports

src/utilities/do-try.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ describe("do-try.ts", () => {
1616
// Arrange
1717
const workload = async () => {
1818
throw ResultRecordFactory.build({
19-
errors: [ResultErrorRecordFactory.build()],
19+
errors: ResultErrorRecordFactory.buildList(1),
2020
});
2121
};
2222

@@ -136,7 +136,7 @@ describe("do-try.ts", () => {
136136
// Arrange
137137
const workload = () => {
138138
throw ResultRecordFactory.build({
139-
errors: [ResultErrorRecordFactory.build()],
139+
errors: ResultErrorRecordFactory.buildList(1),
140140
});
141141
};
142142

src/utilities/do-try.ts

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
11
import { ResultRecord } from "../view-models/result-record";
2-
3-
// -----------------------------------------------------------------------------------------
4-
// #region Utility Types
5-
// -----------------------------------------------------------------------------------------
6-
7-
type AsyncWorkload<T> = () => Promise<T>;
8-
type SyncWorkload<T> = () => T;
9-
type CatchHandler<T> = (result?: ResultRecord<T>, error?: any) => void;
10-
type FinallyHandler = () => void;
11-
12-
// #endregion Utility Types
2+
import {
3+
AsyncWorkload,
4+
SyncWorkload,
5+
CatchHandler,
6+
FinallyHandler,
7+
} from "../types/do-try-types";
138

149
// -----------------------------------------------------------------------------------------
1510
// #region Do

0 commit comments

Comments
 (0)