I would like to have error codes in my Java project, but they should have variable String descriptions. For example, I might have two BadCharacterCount errors, but I'd like to represent them as two different strings, e.g. "Bad character count: expected 50, got 60" and "Bad character count: expected 40, got 70." I'd like to be able to recognize both of these cases as BadCharacterCount errors, and ideally have these in an enum of some sort.
There's a nice discussion of a similar problem here: Best way to define error codes/strings in Java?
However, they don't deal with the case of variable error Strings... Any ideas?