Skip to content

Commit efa7358

Browse files
committed
More section validations
1 parent bc87cc0 commit efa7358

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

editor.html

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -799,6 +799,22 @@ <h1>Telegram Limits Editor</h1>
799799
const structureSection = this.structure.find(section => section.id === sectionId);
800800
const localizationSection = this.localization[sectionId];
801801

802+
if (!localizationSection.name) {
803+
throw new ValidationError(`Section name is empty for section ${sectionId}`, true);
804+
}
805+
806+
if (!structureSection.color) {
807+
throw new ValidationError(`Section color is empty for section ${sectionId}`, true);
808+
}
809+
810+
if (!structureSection.icon) {
811+
throw new ValidationError(`Section icon is empty for section ${sectionId}`, true);
812+
}
813+
814+
if (!this.iconCodePoints[structureSection.icon]) {
815+
throw new ValidationError(`Icon ${structureSection.icon} is not found in the icon code points map for section ${sectionId}`, true);
816+
}
817+
802818
const rgbRegex = /^(\d{1,3}), (\d{1,3}), (\d{1,3})$/;
803819

804820
const match = structureSection.color.match(rgbRegex);
@@ -846,11 +862,11 @@ <h1>Telegram Limits Editor</h1>
846862
const iconName = item.icon;
847863

848864
if (iconName.length === 0) {
849-
throw new ValidationError(`Icon name is empty for item ${item.id} in section ${sectionId}`);
865+
throw new ValidationError(`Icon name is empty for item ${item.id} in section ${sectionId}`, true);
850866
}
851867

852868
if (!this.iconCodePoints[iconName]) {
853-
throw new ValidationError(`Icon ${iconName} is not found in the icon code points map for item ${item.id} in section ${sectionId}`);
869+
throw new ValidationError(`Icon ${iconName} is not found in the icon code points map for item ${item.id} in section ${sectionId}`, true);
854870
}
855871
}
856872
}

0 commit comments

Comments
 (0)