Skip to content

Commit

Permalink
[extensions] Improve IAE message thrown by FormFieldRegistry
Browse files Browse the repository at this point in the history
  • Loading branch information
Flowdalic committed Jan 18, 2024
1 parent 8133505 commit e504bc2
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,13 @@ public static void register(String formType, String fieldName, FormField.Type fi
} else {
previousType = fieldNameToType.get(fieldName);
if (previousType != null && previousType != fieldType) {
throw new IllegalArgumentException();
String message = "The field '" + fieldName + "' from form type '" + formType
+ "' was already registered with field type '" + previousType
+ "' while it is now seen with type '" + fieldType
+ "'. Form field types have to be unambigiously."
+ " XMPP uses a registry for form field tpes, scoped by the form type."
+ " You may find the correct value at https://xmpp.org/registrar/formtypes.html";
throw new IllegalArgumentException(message);
}
}
previousType = fieldNameToType.put(fieldName, fieldType);
Expand Down

0 comments on commit e504bc2

Please sign in to comment.