lwc-polyglot
lwc-polyglot copied to clipboard
VF Insufficient privileges
@ruslan-kurchenko If user does not have access to VF page you will get error "Maximum stack depth reached: 1001".
I would suggest to add some logic to handle this in catch block line 86.
private static CustomLabelsResult resolveCustomLabels(
Set<String> names,
CustomLabelsResult result
) {
try {
result.labels.putAll(new CustomLabelsPage(names).getContent());
} catch (VisualforceException ex) {
result.success = false;
if (ex.getMessage().contains('You do not have sufficient privileges to access the page')) {
result.messages.put('Exception', ex.getMessage());
return result;
}
String invalidLabelName = ex.getMessage()
.substringBetween('Field $Label.', ' does not exist');
result.messages.put(invalidLabelName, ex.getMessage());
result.labels.put(invalidLabelName, invalidLabelName);
names.remove(invalidLabelName);
if (result.messages.size() == 100) {
Integer numbOfAllCustomLabels = result.messages.size() + names.size();
for (String name : names) {
result.messages.put(
name,
'The system reached the limit of 100 tries to resolve ' +
numbOfAllCustomLabels +
' custom labels. The custom label $Label.' +
name +
' is not resolved. Please, contact your System Administrator.'
);
result.labels.put(name, name);
}
} else if (names.size() > 0) {
resolveCustomLabels(names, result);
}
}
return result;
}
@tehn-r thank you! I'll take it to my list, appreciate it 🙏