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

jumpinjackie / mapguide-react-layout / 15160437878

21 May 2025 11:00AM UTC coverage: 21.631% (-42.6%) from 64.24%
15160437878

Pull #1552

github

web-flow
Merge 8b7153d9e into 236e2ea07
Pull Request #1552: Feature/package updates 2505

839 of 1165 branches covered (72.02%)

11 of 151 new or added lines in 25 files covered. (7.28%)

1332 existing lines in 50 files now uncovered.

4794 of 22163 relevant lines covered (21.63%)

6.89 hits per line

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

88.57
/src/components/error.tsx
1
import * as React from "react";
1✔
2
import { InitError } from "../api/common";
3
import { isError, isInitError } from "../utils/type-guards";
1✔
4
import { Intent, Callout } from '@blueprintjs/core';
1✔
5

6
/**
7
 * Error component props
8
 *
9
 * @export
10
 * @interface IErrorProps
11
 */
12
export interface IErrorProps {
13
    error: Error|InitError|string;
14
    errorRenderer?: (err: Error|InitError) => JSX.Element;
15
}
16

17
/**
18
 * Returns a normalized stack trace for the given error object
19
 *
20
 * @export
21
 * @param {(Error|InitError)} err
22
 * @returns {string[]}
23
 */
24
export function normalizeStack(err: Error|InitError): string[] {
1✔
25
    let stack: string[];
1✔
26
    if (err.stack instanceof Array) {
1!
27
        stack = err.stack || [];
×
28
    } else if (typeof(err.stack) == 'string') {
1✔
29
        stack = (err.stack || "").split("\n");
1!
30
    } else {
1!
31
        stack = [];
×
UNCOV
32
    }
×
33
    return stack;
1✔
34
}
1✔
35

36
/**
37
 * The Error component displays an error object in a nicely formatted manner
38
 * @param props
39
 */
40
export const Error = (props: IErrorProps) => {
1✔
41
    const err = props.error;
2✔
42
    if (isError(err) || isInitError(err)) {
2✔
43
        if (props.errorRenderer) {
1!
44
            return props.errorRenderer(err);
×
45
        } else {
1✔
46
            const message = err.message;
1✔
47
            const stack = normalizeStack(err);
1✔
48
            return <Callout intent={Intent.DANGER} icon="error">
1✔
49
                <h5 className="error-header">{err.message}</h5>
1✔
50
                <ul className="error-stack">
1✔
51
                    {stack.map((ln, i) => <li key={`stack-line-${i}`}>{ln}</li>)}
1✔
52
                </ul>
1✔
53
            </Callout>;
1✔
54
        }
1✔
55
    } else {
1✔
56
        return <Callout intent={Intent.DANGER} icon="error">
1✔
57
            <h5 className="error-header">{err}</h5>
1✔
58
        </Callout>;
1✔
59
    }
1✔
60
};
2✔
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