Add a check for the error messages variable so that users can specify their own error format.