-
Notifications
You must be signed in to change notification settings - Fork 675
Expand file tree
/
Copy patherrors.ts
More file actions
79 lines (65 loc) · 2.33 KB
/
Copy patherrors.ts
File metadata and controls
79 lines (65 loc) · 2.33 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
import { BaseError } from "@webiny/feature/api";
export class ExperimentNotFoundError extends BaseError<{ id: string }> {
override readonly code = "WebsiteBuilder/Experiment/NotFound" as const;
constructor(id: string) {
super({
message: "Experiment not found!",
data: {
id
}
});
}
}
export class ExperimentPersistenceError extends BaseError {
override readonly code = "WebsiteBuilder/Experiment/PersistenceError" as const;
constructor(error: Error) {
super({ message: error.message });
}
}
export class ExperimentValidationError extends BaseError {
override readonly code = "WebsiteBuilder/Experiment/ValidationError" as const;
constructor(message: string) {
super({ message });
}
}
/**
* Raised when starting an experiment while another experiment is already running on the
* same revision. v1 allows only one active experiment per revision.
*/
export class ExperimentAlreadyActiveError extends BaseError<{ revisionId: string }> {
override readonly code = "WebsiteBuilder/Experiment/AlreadyActive" as const;
constructor(revisionId: string) {
super({
message: "An experiment is already active on this revision.",
data: {
revisionId
}
});
}
}
export class ExperimentNotAuthorizedError extends BaseError {
override readonly code = "WebsiteBuilder/Experiment/NotAuthorized" as const;
constructor() {
super({ message: "Not authorized!" });
}
}
/** Raised when there is no active (published, running) experiment for a path or revision. */
export class NoActiveExperimentError extends BaseError<{ reference: string }> {
override readonly code = "WebsiteBuilder/Experiment/NoActiveExperiment" as const;
constructor(reference: string) {
super({
message: "No active experiment found.",
data: { reference }
});
}
}
/** Raised when the active experiment is paused (kill-switch); serving falls back to the control. */
export class ExperimentPausedError extends BaseError<{ id: string }> {
override readonly code = "WebsiteBuilder/Experiment/Paused" as const;
constructor(id: string) {
super({
message: "The experiment is paused.",
data: { id }
});
}
}