1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | Object.defineProperty(exports, "__esModule", { value: true });
|
10 | exports.EmptySitemap = exports.EmptyStream = exports.InvalidVideoPriceCurrency = exports.InvalidVideoResolution = exports.InvalidVideoPriceType = exports.InvalidVideoRestrictionRelationship = exports.InvalidVideoRestriction = exports.InvalidVideoFamilyFriendly = exports.InvalidVideoCategory = exports.InvalidVideoTagCount = exports.InvalidVideoViewCount = exports.InvalidVideoTitle = exports.XMLLintUnavailable = exports.InvalidNewsAccessValue = exports.InvalidNewsFormat = exports.InvalidAttr = exports.InvalidAttrValue = exports.InvalidVideoRating = exports.InvalidVideoDescription = exports.InvalidVideoDuration = exports.InvalidVideoFormat = exports.UndefinedTargetFolder = exports.PriorityInvalidError = exports.ChangeFreqInvalidError = exports.NoConfigError = exports.NoURLError = void 0;
|
11 |
|
12 |
|
13 |
|
14 | class NoURLError extends Error {
|
15 | constructor(message) {
|
16 | super(message || 'URL is required');
|
17 | this.name = 'NoURLError';
|
18 | Error.captureStackTrace(this, NoURLError);
|
19 | }
|
20 | }
|
21 | exports.NoURLError = NoURLError;
|
22 |
|
23 |
|
24 |
|
25 | class NoConfigError extends Error {
|
26 | constructor(message) {
|
27 | super(message || 'SitemapItem requires a configuration');
|
28 | this.name = 'NoConfigError';
|
29 | Error.captureStackTrace(this, NoConfigError);
|
30 | }
|
31 | }
|
32 | exports.NoConfigError = NoConfigError;
|
33 |
|
34 |
|
35 |
|
36 | class ChangeFreqInvalidError extends Error {
|
37 | constructor(url, changefreq) {
|
38 | super(`${url}: changefreq "${changefreq}" is invalid`);
|
39 | this.name = 'ChangeFreqInvalidError';
|
40 | Error.captureStackTrace(this, ChangeFreqInvalidError);
|
41 | }
|
42 | }
|
43 | exports.ChangeFreqInvalidError = ChangeFreqInvalidError;
|
44 |
|
45 |
|
46 |
|
47 | class PriorityInvalidError extends Error {
|
48 | constructor(url, priority) {
|
49 | super(`${url}: priority "${priority}" must be a number between 0 and 1 inclusive`);
|
50 | this.name = 'PriorityInvalidError';
|
51 | Error.captureStackTrace(this, PriorityInvalidError);
|
52 | }
|
53 | }
|
54 | exports.PriorityInvalidError = PriorityInvalidError;
|
55 |
|
56 |
|
57 |
|
58 | class UndefinedTargetFolder extends Error {
|
59 | constructor(message) {
|
60 | super(message || 'Target folder must exist');
|
61 | this.name = 'UndefinedTargetFolder';
|
62 | Error.captureStackTrace(this, UndefinedTargetFolder);
|
63 | }
|
64 | }
|
65 | exports.UndefinedTargetFolder = UndefinedTargetFolder;
|
66 | class InvalidVideoFormat extends Error {
|
67 | constructor(url) {
|
68 | super(`${url} video must include thumbnail_loc, title and description fields for videos`);
|
69 | this.name = 'InvalidVideoFormat';
|
70 | Error.captureStackTrace(this, InvalidVideoFormat);
|
71 | }
|
72 | }
|
73 | exports.InvalidVideoFormat = InvalidVideoFormat;
|
74 | class InvalidVideoDuration extends Error {
|
75 | constructor(url, duration) {
|
76 | super(`${url} duration "${duration}" must be an integer of seconds between 0 and 28800`);
|
77 | this.name = 'InvalidVideoDuration';
|
78 | Error.captureStackTrace(this, InvalidVideoDuration);
|
79 | }
|
80 | }
|
81 | exports.InvalidVideoDuration = InvalidVideoDuration;
|
82 | class InvalidVideoDescription extends Error {
|
83 | constructor(url, length) {
|
84 | const message = `${url}: video description is too long ${length} vs limit of 2048 characters.`;
|
85 | super(message);
|
86 | this.name = 'InvalidVideoDescription';
|
87 | Error.captureStackTrace(this, InvalidVideoDescription);
|
88 | }
|
89 | }
|
90 | exports.InvalidVideoDescription = InvalidVideoDescription;
|
91 | class InvalidVideoRating extends Error {
|
92 | constructor(url, title, rating) {
|
93 | super(`${url}: video "${title}" rating "${rating}" must be between 0 and 5 inclusive`);
|
94 | this.name = 'InvalidVideoRating';
|
95 | Error.captureStackTrace(this, InvalidVideoRating);
|
96 | }
|
97 | }
|
98 | exports.InvalidVideoRating = InvalidVideoRating;
|
99 | class InvalidAttrValue extends Error {
|
100 |
|
101 | constructor(key, val, validator) {
|
102 | super('"' +
|
103 | val +
|
104 | '" tested against: ' +
|
105 | validator +
|
106 | ' is not a valid value for attr: "' +
|
107 | key +
|
108 | '"');
|
109 | this.name = 'InvalidAttrValue';
|
110 | Error.captureStackTrace(this, InvalidAttrValue);
|
111 | }
|
112 | }
|
113 | exports.InvalidAttrValue = InvalidAttrValue;
|
114 |
|
115 |
|
116 | class InvalidAttr extends Error {
|
117 | constructor(key) {
|
118 | super('"' + key + '" is malformed');
|
119 | this.name = 'InvalidAttr';
|
120 | Error.captureStackTrace(this, InvalidAttr);
|
121 | }
|
122 | }
|
123 | exports.InvalidAttr = InvalidAttr;
|
124 | class InvalidNewsFormat extends Error {
|
125 | constructor(url) {
|
126 | super(`${url} News must include publication, publication name, publication language, title, and publication_date for news`);
|
127 | this.name = 'InvalidNewsFormat';
|
128 | Error.captureStackTrace(this, InvalidNewsFormat);
|
129 | }
|
130 | }
|
131 | exports.InvalidNewsFormat = InvalidNewsFormat;
|
132 | class InvalidNewsAccessValue extends Error {
|
133 | constructor(url, access) {
|
134 | super(`${url} News access "${access}" must be either Registration, Subscription or not be present`);
|
135 | this.name = 'InvalidNewsAccessValue';
|
136 | Error.captureStackTrace(this, InvalidNewsAccessValue);
|
137 | }
|
138 | }
|
139 | exports.InvalidNewsAccessValue = InvalidNewsAccessValue;
|
140 | class XMLLintUnavailable extends Error {
|
141 | constructor(message) {
|
142 | super(message || 'xmlLint is not installed. XMLLint is required to validate');
|
143 | this.name = 'XMLLintUnavailable';
|
144 | Error.captureStackTrace(this, XMLLintUnavailable);
|
145 | }
|
146 | }
|
147 | exports.XMLLintUnavailable = XMLLintUnavailable;
|
148 | class InvalidVideoTitle extends Error {
|
149 | constructor(url, length) {
|
150 | super(`${url}: video title is too long ${length} vs 100 character limit`);
|
151 | this.name = 'InvalidVideoTitle';
|
152 | Error.captureStackTrace(this, InvalidVideoTitle);
|
153 | }
|
154 | }
|
155 | exports.InvalidVideoTitle = InvalidVideoTitle;
|
156 | class InvalidVideoViewCount extends Error {
|
157 | constructor(url, count) {
|
158 | super(`${url}: video view count must be positive, view count was ${count}`);
|
159 | this.name = 'InvalidVideoViewCount';
|
160 | Error.captureStackTrace(this, InvalidVideoViewCount);
|
161 | }
|
162 | }
|
163 | exports.InvalidVideoViewCount = InvalidVideoViewCount;
|
164 | class InvalidVideoTagCount extends Error {
|
165 | constructor(url, count) {
|
166 | super(`${url}: video can have no more than 32 tags, this has ${count}`);
|
167 | this.name = 'InvalidVideoTagCount';
|
168 | Error.captureStackTrace(this, InvalidVideoTagCount);
|
169 | }
|
170 | }
|
171 | exports.InvalidVideoTagCount = InvalidVideoTagCount;
|
172 | class InvalidVideoCategory extends Error {
|
173 | constructor(url, count) {
|
174 | super(`${url}: video category can only be 256 characters but was passed ${count}`);
|
175 | this.name = 'InvalidVideoCategory';
|
176 | Error.captureStackTrace(this, InvalidVideoCategory);
|
177 | }
|
178 | }
|
179 | exports.InvalidVideoCategory = InvalidVideoCategory;
|
180 | class InvalidVideoFamilyFriendly extends Error {
|
181 | constructor(url, fam) {
|
182 | super(`${url}: video family friendly must be yes or no, was passed "${fam}"`);
|
183 | this.name = 'InvalidVideoFamilyFriendly';
|
184 | Error.captureStackTrace(this, InvalidVideoFamilyFriendly);
|
185 | }
|
186 | }
|
187 | exports.InvalidVideoFamilyFriendly = InvalidVideoFamilyFriendly;
|
188 | class InvalidVideoRestriction extends Error {
|
189 | constructor(url, code) {
|
190 | super(`${url}: video restriction must be one or more two letter country codes. Was passed "${code}"`);
|
191 | this.name = 'InvalidVideoRestriction';
|
192 | Error.captureStackTrace(this, InvalidVideoRestriction);
|
193 | }
|
194 | }
|
195 | exports.InvalidVideoRestriction = InvalidVideoRestriction;
|
196 | class InvalidVideoRestrictionRelationship extends Error {
|
197 | constructor(url, val) {
|
198 | super(`${url}: video restriction relationship must be either allow or deny. Was passed "${val}"`);
|
199 | this.name = 'InvalidVideoRestrictionRelationship';
|
200 | Error.captureStackTrace(this, InvalidVideoRestrictionRelationship);
|
201 | }
|
202 | }
|
203 | exports.InvalidVideoRestrictionRelationship = InvalidVideoRestrictionRelationship;
|
204 | class InvalidVideoPriceType extends Error {
|
205 | constructor(url, priceType, price) {
|
206 | super(priceType === undefined && price === ''
|
207 | ? `${url}: video priceType is required when price is not provided`
|
208 | : `${url}: video price type "${priceType}" is not "rent" or "purchase"`);
|
209 | this.name = 'InvalidVideoPriceType';
|
210 | Error.captureStackTrace(this, InvalidVideoPriceType);
|
211 | }
|
212 | }
|
213 | exports.InvalidVideoPriceType = InvalidVideoPriceType;
|
214 | class InvalidVideoResolution extends Error {
|
215 | constructor(url, resolution) {
|
216 | super(`${url}: video price resolution "${resolution}" is not hd or sd`);
|
217 | this.name = 'InvalidVideoResolution';
|
218 | Error.captureStackTrace(this, InvalidVideoResolution);
|
219 | }
|
220 | }
|
221 | exports.InvalidVideoResolution = InvalidVideoResolution;
|
222 | class InvalidVideoPriceCurrency extends Error {
|
223 | constructor(url, currency) {
|
224 | super(`${url}: video price currency "${currency}" must be a three capital letter abbrieviation for the country currency`);
|
225 | this.name = 'InvalidVideoPriceCurrency';
|
226 | Error.captureStackTrace(this, InvalidVideoPriceCurrency);
|
227 | }
|
228 | }
|
229 | exports.InvalidVideoPriceCurrency = InvalidVideoPriceCurrency;
|
230 | class EmptyStream extends Error {
|
231 | constructor() {
|
232 | super('You have ended the stream before anything was written. streamToPromise MUST be called before ending the stream.');
|
233 | this.name = 'EmptyStream';
|
234 | Error.captureStackTrace(this, EmptyStream);
|
235 | }
|
236 | }
|
237 | exports.EmptyStream = EmptyStream;
|
238 | class EmptySitemap extends Error {
|
239 | constructor() {
|
240 | super('You ended the stream without writing anything.');
|
241 | this.name = 'EmptySitemap';
|
242 | Error.captureStackTrace(this, EmptyStream);
|
243 | }
|
244 | }
|
245 | exports.EmptySitemap = EmptySitemap;
|