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

safe-global / safe-client-gateway / 11340871916

15 Oct 2024 06:58AM UTC coverage: 46.83% (-45.0%) from 91.836%
11340871916

push

github

web-flow
Bump typescript from 5.6.2 to 5.6.3 (#2015)

Bumps [typescript](https://github.com/microsoft/TypeScript) from 5.6.2 to 5.6.3.
- [Release notes](https://github.com/microsoft/TypeScript/releases)
- [Changelog](https://github.com/microsoft/TypeScript/blob/main/azure-pipelines.release.yml)
- [Commits](https://github.com/microsoft/TypeScript/compare/v5.6.2...v5.6.3)

---
updated-dependencies:
- dependency-name: typescript
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

500 of 3096 branches covered (16.15%)

Branch coverage included in aggregate %.

5092 of 8845 relevant lines covered (57.57%)

12.16 hits per line

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

60.78
/src/logging/utils.ts
1
import type { Request } from 'express';
2
import { get } from 'lodash';
16✔
3

4
const HEADER_IP_ADDRESS = 'X-Real-IP';
16✔
5
const HEADER_SAFE_APP_USER_AGENT = 'Safe-App-User-Agent';
16✔
6
const HEADER_ORIGIN = 'Origin';
16✔
7

8
export function formatRouteLogMessage(
16✔
9
  statusCode: number,
10
  request: Request,
11
  startTimeMs: number,
12
  detail?: string,
13
): {
14
  chain_id: string | null;
15
  client_ip: string | null;
16
  method: string;
17
  response_time_ms: number;
18
  route: string;
19
  path: string;
20
  safe_app_user_agent: string | null;
21
  status_code: number;
22
  detail: string | null;
23
  origin: string | null;
24
} {
25
  const clientIp = request.header(HEADER_IP_ADDRESS) ?? null;
18!
26
  const safeAppUserAgent = request.header(HEADER_SAFE_APP_USER_AGENT) ?? null;
18✔
27
  const chainId = request.params['chainId'] ?? null;
18✔
28
  const origin = request.header(HEADER_ORIGIN) ?? null;
18!
29

30
  return {
18✔
31
    chain_id: chainId,
32
    client_ip: clientIp,
33
    method: request.method,
34
    response_time_ms: performance.now() - startTimeMs,
35
    route: request.route.path,
36
    path: request.url,
37
    safe_app_user_agent: safeAppUserAgent,
38
    status_code: statusCode,
39
    detail: detail ?? null,
27✔
40
    origin,
41
  };
42
}
43

44
/**
45
 * Coerces an unknown value into an {@link Error} with defined {@link message}:
46
 *
47
 * @param thrown - The value to coerce into an {@link Error}
48
 *
49
 * - If the value is an {@link Error}, it is returned as is.
50
 *
51
 * The {@link message} of the returned {@link Error} is otherwise defined as follows:
52
 *
53
 * - If {@link thrown} is a string, it is used as the {@link message}.
54
 * - If {@link thrown} is an object, it tries to get a `message` property and uses it as the {@link message}.
55
 * - If {@link thrown} is an object without a `message` property, it tries to stringify it and use it as the {@link message}.
56
 * - If stringify fails, it converts {@link thrown} to string and uses it as the {@link message}.
57
 *
58
 * @returns {@link Error} containing {@link message}
59
 */
60
export const asError = (thrown: unknown): Error => {
16✔
61
  if (thrown instanceof Error) {
×
62
    return thrown;
×
63
  }
64

65
  let message: string;
66

67
  if (typeof thrown === 'string') {
×
68
    message = thrown;
×
69
  } else {
70
    try {
×
71
      message = get(thrown, 'message') ?? JSON.stringify(thrown);
×
72
    } catch {
73
      message = String(thrown);
×
74
    }
75
  }
76

77
  return new Error(message);
×
78
};
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