• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

yiming-liao / logry / 18439742378

12 Oct 2025 05:30AM UTC coverage: 96.196% (+0.4%) from 95.783%
18439742378

push

github

yiming-liao
chore(release): bump version to 1.2.2

463 of 513 branches covered (90.25%)

Branch coverage included in aggregate %.

3937 of 4061 relevant lines covered (96.95%)

3.99 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

85.37
/src/core/handler-manager/utils/execute-handler.ts
1
import type { OnErrorCallback } from "@/core/handler-manager/handler-manager-config-types";
1✔
2
import type { Handler } from "@/core/handler-manager/types";
1✔
3
import type { RawPayload } from "@/shared/types/log-payload";
1✔
4
import { isHandlerClass } from "@/core/handler-manager/utils/is-handler-class";
1✔
5

1✔
6
type ExecuteHandlerOptions = {
1✔
7
  handler: Handler;
1✔
8
  id: string;
1✔
9
  rawPayload: RawPayload;
1✔
10
  onError?: OnErrorCallback;
1✔
11
};
1✔
12

1✔
13
/**
1✔
14
 * Executes a logging handler with the provided payload.
1✔
15
 * Supports handlers defined as functions or as class instances with a `handle` method.
1✔
16
 * If the handler throws an error, it will be caught and passed to the optional error callback.
1✔
17
 *
1✔
18
 * @param handler - The handler to execute (function or class instance).
1✔
19
 * @param id - Identifier for the handler, used in error callback.
1✔
20
 * @param rawPayload - The raw log payload to be passed to the handler.
1✔
21
 * @param onError - Optional callback to handle errors thrown by the handler.
1✔
22
 */
1✔
23
export const executeHandler = async ({
1✔
24
  handler,
3✔
25
  id,
3✔
26
  rawPayload,
3✔
27
  onError,
3✔
28
}: ExecuteHandlerOptions): Promise<void> => {
3✔
29
  try {
3✔
30
    if (typeof handler === "function") {
3✔
31
      await handler(rawPayload);
3✔
32
    } else if (isHandlerClass(handler)) {
3!
33
      await handler.handle(rawPayload);
×
34
    }
×
35
  } catch (error) {
3!
36
    onError?.({ error, id });
×
37
  }
×
38
};
3✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc