-
Notifications
You must be signed in to change notification settings - Fork 481
Expand file tree
/
Copy patherrors.ts
More file actions
50 lines (45 loc) · 1.84 KB
/
Copy patherrors.ts
File metadata and controls
50 lines (45 loc) · 1.84 KB
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
46
47
48
49
50
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
import type { RequestedLib } from 'firefox-profiler/types';
// Used during the symbolication process to express that we couldn't find
// symbols for a specific library
export class SymbolsNotFoundError extends Error {
library: RequestedLib;
errors: Error[];
constructor(message: string, library: RequestedLib, ...errors: Error[]) {
super(
[message, ...errors.map((e) => ` - ${e.name}: ${e.message}`)].join('\n')
);
// Workaround for a babel issue when extending Errors
(this as any).__proto__ = SymbolsNotFoundError.prototype;
this.name = 'SymbolsNotFoundError';
this.library = library;
this.errors = errors;
}
}
// Thrown when a profile's format version is newer than the most recent version
// understood by this build. The message is deliberately neutral and only states
// the facts. Consumers (the web app, the CLI) detect this by name and append
// their own advice on how to update, since that advice is frontend-specific.
export class ProfileVersionError extends Error {
formatName: string;
profileVersion: number;
supportedVersion: number;
constructor(
formatName: string,
profileVersion: number,
supportedVersion: number
) {
super(
`Unable to parse a ${formatName} profile of version ${profileVersion}. ` +
`The most recent version understood by this build is version ${supportedVersion}.`
);
// Workaround for a babel issue when extending Errors
(this as any).__proto__ = ProfileVersionError.prototype;
this.name = 'ProfileVersionError';
this.formatName = formatName;
this.profileVersion = profileVersion;
this.supportedVersion = supportedVersion;
}
}