Skip to content

Commit

Permalink
fixed format
Browse files Browse the repository at this point in the history
  • Loading branch information
Francesco Rivola committed Feb 11, 2024
1 parent c6ae919 commit 6671c0c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
14 changes: 7 additions & 7 deletions src/fire-and-forgetter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export type FireAndForgetter = {
} & ((
func: (signal: AbortSignal) => Promise<void>,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
onError?: (error: any) => void
onError?: (error: any) => void,
) => void);

type CloseOptions = {
Expand Down Expand Up @@ -54,7 +54,7 @@ export function fireAndForgetter(options?: Options): FireAndForgetter {
*/
function fireAndForget(
func: (signal: AbortSignal) => Promise<void>,
onError: (error) => void = defaultOnError
onError: (error) => void = defaultOnError,
): void {
if (closing) {
handleClosing(onError);
Expand All @@ -65,7 +65,7 @@ export function fireAndForgetter(options?: Options): FireAndForgetter {

async function fire(
func: (signal: AbortSignal) => Promise<void>,
onError: (error) => void
onError: (error) => void,
): Promise<void> {
try {
counter.incrementCounter();
Expand All @@ -79,7 +79,7 @@ export function fireAndForgetter(options?: Options): FireAndForgetter {

function handleClosing(onError: (error) => void) {
const closingError = new ClosingError(
"Cannot longer execute fire and forget operation as is closing or closed"
"Cannot longer execute fire and forget operation as is closing or closed",
);
if (throwOnClosing) {
throw closingError;
Expand Down Expand Up @@ -118,10 +118,10 @@ export function fireAndForgetter(options?: Options): FireAndForgetter {
() =>
reject(
new TimeoutClosingError(
`Cannot close after ${timeout}ms, ${counter.getCount()} fire and forget operations are still in progress`
)
`Cannot close after ${timeout}ms, ${counter.getCount()} fire and forget operations are still in progress`,
),
),
timeout
timeout,
);
}
});
Expand Down
8 changes: 4 additions & 4 deletions test/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ describe("fire-and-forgetter", () => {
equal(error instanceof TimeoutClosingError, true);
equal(
(error as Error).message,
"Cannot close after 10ms, 3 fire and forget operations are still in progress"
"Cannot close after 10ms, 3 fire and forget operations are still in progress",
);
equal(count, 0);
functionHasThrownError = true;
Expand All @@ -116,7 +116,7 @@ describe("fire-and-forgetter", () => {
equal(error instanceof Error, true);
equal((error as Error).message, "ups, some error happened");
onErrorHasBeenCalled = true;
}
},
);

await fireAndForget.close();
Expand Down Expand Up @@ -165,7 +165,7 @@ describe("fire-and-forgetter", () => {
equal(error instanceof ClosingError, true);
equal(
(error as Error).message,
"Cannot longer execute fire and forget operation as is closing or closed"
"Cannot longer execute fire and forget operation as is closing or closed",
);
functionHasThrownError = true;
}
Expand Down Expand Up @@ -196,7 +196,7 @@ describe("fire-and-forgetter", () => {
equal(reportedError instanceof ClosingError, true);
equal(
(reportedError as Error).message,
"Cannot longer execute fire and forget operation as is closing or closed"
"Cannot longer execute fire and forget operation as is closing or closed",
);
});
});

0 comments on commit 6671c0c

Please sign in to comment.