previous | index | next

Reporting Conversion Errors

Custom converters must create conversion error messages.

The getAsObject method in CreditCardConverter uses the javax.faces.application.FacesMessage class for this:

     if (foundInvalidCharacter) {
         FacesMessage message = new FacesMessage(
            "Conversion error occurred. ", "Invalid card number. ");
         message.setSeverity(FacesMessage.SEVERITY_ERROR);
         throw new ConverterException(message);
     }

Here is the FacesMessage API.

Here is the ConverterException API.


previous | index | next