@packtrack/layout 1.3.2 → 1.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.built/source/layout.js +5 -5
- package/package.json +1 -1
- package/source/layout.ts +5 -5
package/.built/source/layout.js
CHANGED
|
@@ -206,12 +206,12 @@ export class Layout {
|
|
|
206
206
|
findSection(path, base, source = base) {
|
|
207
207
|
const parts = path.split('.');
|
|
208
208
|
if (parts.length == 0) {
|
|
209
|
-
throw `
|
|
209
|
+
throw new Error(`Section '${path}' not found from '${source.domainName}': invalid name`);
|
|
210
210
|
}
|
|
211
211
|
if (parts.length == 1) {
|
|
212
212
|
const localSection = base.sections.find(section => section.name == parts[0]);
|
|
213
213
|
if (!localSection) {
|
|
214
|
-
throw new Error(`Section '${path}' not found from '${source.
|
|
214
|
+
throw new Error(`Section '${path}' not found from '${source.domainName}': section does not exist in '${base.name}'`);
|
|
215
215
|
}
|
|
216
216
|
return localSection;
|
|
217
217
|
}
|
|
@@ -219,19 +219,19 @@ export class Layout {
|
|
|
219
219
|
let pool = base;
|
|
220
220
|
for (let index = 0; index < parts.length; index++) {
|
|
221
221
|
if (pool instanceof Layout || !pool.parent) {
|
|
222
|
-
throw new Error(`Section '${path}' could not be found from '${source.
|
|
222
|
+
throw new Error(`Section '${path}' could not be found from '${source.domainName}': district '${pool.name}' does not have a parent`);
|
|
223
223
|
}
|
|
224
224
|
pool = pool.parent;
|
|
225
225
|
}
|
|
226
226
|
for (let part of parts) {
|
|
227
227
|
const child = (pool instanceof District ? pool.children : pool.districts).find(child => child.name == part);
|
|
228
228
|
if (!child) {
|
|
229
|
-
throw new Error(`Section '${path}' could not be found from '${source.
|
|
229
|
+
throw new Error(`Section '${path}' could not be found from '${source.domainName}': district '${pool.name}' does not have a child named '${part}'`);
|
|
230
230
|
}
|
|
231
231
|
pool = child;
|
|
232
232
|
}
|
|
233
233
|
if (pool instanceof Layout) {
|
|
234
|
-
throw new Error(`Section '${path}' could not be found from '${source.
|
|
234
|
+
throw new Error(`Section '${path}' could not be found from '${source.domainName}': a layout cannot directly include a section`);
|
|
235
235
|
}
|
|
236
236
|
return this.findSection(sectionName, pool, source);
|
|
237
237
|
}
|
package/package.json
CHANGED
package/source/layout.ts
CHANGED
|
@@ -293,14 +293,14 @@ export class Layout {
|
|
|
293
293
|
const parts = path.split('.');
|
|
294
294
|
|
|
295
295
|
if (parts.length == 0) {
|
|
296
|
-
throw `
|
|
296
|
+
throw new Error(`Section '${path}' not found from '${source.domainName}': invalid name`);
|
|
297
297
|
}
|
|
298
298
|
|
|
299
299
|
if (parts.length == 1) {
|
|
300
300
|
const localSection = base.sections.find(section => section.name == parts[0]);
|
|
301
301
|
|
|
302
302
|
if (!localSection) {
|
|
303
|
-
throw new Error(`Section '${path}' not found from '${source.
|
|
303
|
+
throw new Error(`Section '${path}' not found from '${source.domainName}': section does not exist in '${base.name}'`);
|
|
304
304
|
}
|
|
305
305
|
|
|
306
306
|
return localSection;
|
|
@@ -312,7 +312,7 @@ export class Layout {
|
|
|
312
312
|
|
|
313
313
|
for (let index = 0; index < parts.length; index++) {
|
|
314
314
|
if (pool instanceof Layout || !pool.parent) {
|
|
315
|
-
throw new Error(`Section '${path}' could not be found from '${source.
|
|
315
|
+
throw new Error(`Section '${path}' could not be found from '${source.domainName}': district '${pool.name}' does not have a parent`);
|
|
316
316
|
}
|
|
317
317
|
|
|
318
318
|
pool = pool.parent!;
|
|
@@ -322,14 +322,14 @@ export class Layout {
|
|
|
322
322
|
const child = (pool instanceof District ? pool.children : pool.districts).find(child => child.name == part);
|
|
323
323
|
|
|
324
324
|
if (!child) {
|
|
325
|
-
throw new Error(`Section '${path}' could not be found from '${source.
|
|
325
|
+
throw new Error(`Section '${path}' could not be found from '${source.domainName}': district '${pool.name}' does not have a child named '${part}'`);
|
|
326
326
|
}
|
|
327
327
|
|
|
328
328
|
pool = child;
|
|
329
329
|
}
|
|
330
330
|
|
|
331
331
|
if (pool instanceof Layout) {
|
|
332
|
-
throw new Error(`Section '${path}' could not be found from '${source.
|
|
332
|
+
throw new Error(`Section '${path}' could not be found from '${source.domainName}': a layout cannot directly include a section`);
|
|
333
333
|
}
|
|
334
334
|
|
|
335
335
|
return this.findSection(sectionName, pool, source);
|