Standard Error Messages

To make life easier for our users and our translators, please use this set of standard error messages. The entries below are formatted so that they can be copied straight into your ApplicationResources.properties file. Please do not remove the "#" comments as these will be shown in the translation utility.

User Error Messages

These are error messages that warn the user of something within their (or another users) control.

# Error message (Monitoring): Content cannot be modified as learners are already using it.
error.content.locked=The content has been locked since it is being used by one or more learners. The modification of the content is not allowed.
# Error message (Learning): Content cannot be used as it is not yet defined.
error.defineLater=Sorry, the activity is not ready yet. Please wait for the teacher to finishing defining the activity.
# Error message: Uploaded file exceeded maximum file size
errors.maxfilesize=The uploaded file has exceeded the maximum file size limit of \{0\} bytes
# Error message: User hasn't field in a mandatory field
error.mandatoryField=\{0\} field is mandatory.
# Error message: User hasn't entered a valid Integer number
error.mark.invalid.number=\{0\} field must be a valid number. Decimal points are not allowed.
# Error message: User hasn't entered a valid Decimal number
error.mark.invalid.decimal.number=\{0\} field must be a valid decimal number.

System Error Messages

To reduce the work (and confusion) for our translators, keep any system error messages to a minimum. For example, rather than than having "ToolContentID is missing", use "An error has occurred. Please start again. Parameter {0} is missing." and use ToolContentID as the replacement value.

If an exception occurs then you can use "An error has occurred. Please start again. Reason for error: {0} " and replace {0} with the exception text. If this occurs then the user may see the message in a mixture of languages. For example, if they are using Bulgarian they will see the "An error has occurred. Please start again. Reason for error: " in Bulgarian and the exception message in English.

The idea is to give the user enough information so that they know a system error has occurred, and there should be enough information on the screen so that if they do a screen dump and send it back to the developer, the developer will have some idea about the problem. The user doesn't need to understand the full message - most of our users won't have a clue what a ToolContentID is irrespective of the language!

# General system error message.
error.system.error=An error has occurred. Please start again. Reason for error: \{0\}
# A parameter is missing. \{0\} replaced with parameter name
error.missingParam=An error has occurred. Please start again. Parameter \{0\} is missing.
# Unable to find a file on the system
error.msg.upload.file.not.found=Could not find file \{0\}.
# Unable to upload a file to the system
error.upload.failed=Uploading the file failed: \{0\}

ActionMessages Tips

Every now and then the JSPs need to present the user with messages like: "An error has occurred. Please start again. Parameter ToolContentID is missing.", where the messages are generated programmatically. Given below are some suggestions on how to do this.

The suggestions here apply ONLY to server (Struts Action) originated messages as opposed to form validation messages. So, the suggestions here does not apply to individual field level corrections. Individual field level corrections usually takes the user of the system to a particular field to fix an error. Now, this section is about raising and presenting all general user messages, feedback and optionally warnings for field level corrections.

The usual practice is to present a server originated messages (not necessarily error messages only) at the top section of the related screen.

For the purpose of displaying Struts 1.2.7 Action Messages in the JSP pages we can follow the following practice:

Assume that an input parameter "toolContentID" is mandatory.

We could have some verification code in the related Action class as:

if ((toolContentID == null))
    ActionMessages errors= new ActionMessages();
    errors.add(Globals.ERROR_KEY,new ActionMessage("error.missingParam"),"ToolContentID");
    saveErrors(request,errors);
    return (mapping.findForward(<next page>));

To display the error:

<%@ taglib uri="tags-html" prefix="html" %>
<%@ taglib uri="tags-core" prefix="c" %>
<%@ taglib uri="tags-logic" prefix="logic" %>
<%@ taglib uri="tags-lams" prefix="lams" %>

<div id="datatablecontainer">
<logic:messagesPresent>
<table border="0" cellspacing="2" cellpadding="2" summary="This table is being used for layout purposes only">
<tr>
	<td width="10%"  align="right" >
		<img src="<lams:LAMSURL/>/images/error.jpg" alt="Error occured"/>
	</td>
	<td width="90%" valign="middle" class="body" colspan="2">
		 <html:messages id="error" message="false">
			 <c:out value="${error}" escapeXml="false"/><BR>
		 </html:messages>
	</td>
</tr>
</logic:messagesPresent>
</div>
<table align=center>
<tr>
<td class="error">
        <%@ include file="errorbox.jsp" %>
</td> </tr>
<table>