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

rokucommunity / roku-debug / 26120672946

19 May 2026 07:37PM UTC coverage: 70.727% (+0.7%) from 70.049%
26120672946

Pull #351

github

web-flow
Merge eb0b2e542 into 5bbd82240
Pull Request #351: 0.23.8

3328 of 5046 branches covered (65.95%)

Branch coverage included in aggregate %.

5834 of 7908 relevant lines covered (73.77%)

35.01 hits per line

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

80.43
/src/debugProtocol/events/requests/SetExceptionBreakpointsRequest.ts
1
import { SmartBuffer } from 'smart-buffer';
2
import { Command } from '../../Constants';
2✔
3
import { protocolUtil } from '../../ProtocolUtil';
2✔
4
import type { ProtocolRequest } from '../ProtocolEvent';
2✔
5

2✔
6
const ExceptionBreakpointFilterType = {
2✔
7
    '1': 'caught',
2✔
8
    '2': 'uncaught',
9
    caught: 1,
10
    uncaught: 2
11
};
12

13
export class SetExceptionBreakpointsRequest implements ProtocolRequest {
14

15
    public static fromJson(data: {
4✔
16
        requestId: number;
17
        breakpoints: Array<ExceptionBreakpoint>;
18
    }) {
19
        const request = new SetExceptionBreakpointsRequest();
4✔
20
        protocolUtil.loadJson(request, data);
4✔
21
        request.data.breakpoints ??= [];
22
        return request;
23
    }
24

25
    public static fromBuffer(buffer: Buffer) {
26
        const request = new SetExceptionBreakpointsRequest();
27
        protocolUtil.bufferLoaderHelper(request, buffer, 12, (smartBuffer) => {
28
            protocolUtil.loadCommonRequestFields(request, smartBuffer);
29

30
            const numBreakpoints = smartBuffer.readUInt32LE(); // num_breakpoints
31
            request.data.breakpoints = [];
2✔
32
            for (let i = 0; i < numBreakpoints; i++) {
2✔
33
                const filterTypeId = smartBuffer.readUInt32LE();
2!
34
                request.data.breakpoints.push({
2✔
35
                    filter: ExceptionBreakpointFilterType[filterTypeId], // filter
36
                    conditionExpression: protocolUtil.readStringNT(smartBuffer) // cond_expr
37
                });
2✔
38
            }
2✔
39
        });
2✔
40
        return request;
2✔
41
    }
2✔
42

2✔
43
    public toBuffer(): Buffer {
2✔
44
        const smartBuffer = new SmartBuffer();
2✔
45

46
        smartBuffer.writeUInt32LE(this.data.breakpoints.length); // num_breakpoints
47
        for (const breakpoint of this.data.breakpoints) {
48
            const filterTypeId = ExceptionBreakpointFilterType[breakpoint.filter] as number;
49
            smartBuffer.writeUInt32LE(filterTypeId); // filter
50
            smartBuffer.writeStringNT(breakpoint.conditionExpression ?? ''); // cond_expr
2✔
51
        }
52

53
        protocolUtil.insertCommonRequestFields(this, smartBuffer);
54
        return smartBuffer.toBuffer();
2✔
55
    }
2✔
56

2✔
57
    private filterToNumber(filter: string): number {
2✔
58
        switch (filter) {
2✔
59
            case 'caught': return 1;
2!
60
            case 'uncaught': return 2;
61
            default: throw new Error(`Unknown filter: ${filter}`);
2✔
62
        }
2✔
63
    }
64

65
    public success = false;
×
66
    /**
×
67
     * How many bytes were read by the `fromBuffer` method. Only populated when constructed by `fromBuffer`
×
68
     */
×
69
    public readOffset: number = undefined;
70

71
    public data = {
72
        breakpoints: undefined as Array<{
2✔
73
            filter: string;
74
            conditionExpression: string;
75
        }>,
76

77
        //common props
78
        packetLength: undefined as number,
79
        requestId: undefined as number,
80
        command: Command.SetExceptionBreakpoints
81
    };
82
}
83

84

85
export interface ExceptionBreakpoint {
86
    /**
87
     * Possible values: 'caught', 'uncaught'
88
     */
89
    filter: 'caught' | 'uncaught';
90
    conditionExpression?: string;
91
}
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