-
Notifications
You must be signed in to change notification settings - Fork 9.4k
/
lh-trace-processor.js
45 lines (39 loc) · 1.24 KB
/
lh-trace-processor.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/**
* @license
* Copyright 2021 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import {LighthouseError} from '../lib/lh-error.js';
import {TraceProcessor} from '../lib/tracehouse/trace-processor.js';
// TraceProcessor throws generic errors, but we'd like our special localized and code-specific LighthouseError
// objects to be thrown instead.
class LHTraceProcessor extends TraceProcessor {
/**
* @return {Error}
*/
static createNoNavstartError() {
return new LighthouseError(LighthouseError.errors.NO_NAVSTART);
}
/**
* This isn't currently used, but will be when the time origin of trace processing is changed.
* @see {TraceProcessor.computeTimeOrigin}
* @see https://github.com/GoogleChrome/lighthouse/pull/11253#discussion_r507985527
* @return {Error}
*/
static createNoResourceSendRequestError() {
return new LighthouseError(LighthouseError.errors.NO_RESOURCE_REQUEST);
}
/**
* @return {Error}
*/
static createNoTracingStartedError() {
return new LighthouseError(LighthouseError.errors.NO_TRACING_STARTED);
}
/**
* @return {Error}
*/
static createNoFirstContentfulPaintError() {
return new LighthouseError(LighthouseError.errors.NO_FCP);
}
}
export default LHTraceProcessor;