Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "CosmosDataReportingComponent10 209223"

(Replacing or Configuring the default logging mechanism)
Line 1: Line 1:
 +
Back to [[CosmosDataReportingDesign|Data Reporting Design]]
 +
 
=Overview=
 
=Overview=
 
There are two tiers to the COSMOS UI.
 
There are two tiers to the COSMOS UI.

Revision as of 16:36, 13 November 2007

Back to Data Reporting Design

Overview

There are two tiers to the COSMOS UI.

  • Client-side
  • Server-side

This enhancement will ocver the error handling for the client-side tier.

Requirement

In general the COSMOS UI message logging should adopt similar message logging strategies used by other sub projects. These strategies should satisfy the following requirements:

  1. Provide the ability to log warning, informational and error messages
  2. Provide the ability to replace the logging mechanism with a custom mechanism
  3. Provide the ability to prompt the user with warning, informational or error messages

Design

Error Handler

The COMSOS UI will define a default error handler object that will be defined as a dojo object. This will allow exploiters to extend or replace the error handler by utilizing the dojo programming model.

The following defines the error handler object:

dojo.declare("cosmos.ui.provisional.error.handler.ErrorHandler", null , {
	constructor: function( keywordParameters){
	},	
 	serverHandler:null,
	//defines a url that will recieve logged messages.
	debug:0,
	//atribute that determins if the message should be logged to the dojo debug console.
	promptDialog:null,
	//defines the dialog box that will show the message.
	prompt:0,
	//attribute that determines if a dialog box should be displayed when a message is logged
	logError:function(message, prompt) {
	// summary: logs an error messages
	// description: the message is logged as an error message.  If the prompt argument
 	//    is set to true a dialog message is presented to the user.
	},
	logWarning:function(message, prompt) {
	// summary: logs a warning messages
	// description: the message is logged as a warning message.  If the prompt argument
 	//    is set to true a dialog message is presented to the user.
	},
	logInfo:function(message, prompt) {
	// summary: logs an informational messages
	// description: the message is logged as an informational message.  If the prompt argument
 	//    is set to true a dialog message is presented to the user.
	}
});

var MESSAGETYPE = {ERROR: 1,INFO:2,WARNING:4,NONE:0}

Logging Messages

Javascript objects that want to log messages would use the "cosmos.log" global variable as follows:

	//log error or informational messages to the debug console
	cosmos.log.debug=MESSAGETYPE.ERROR|MESSAGETYPE.INFO;
	//prompt the user for warning messages
	cosmos.log.prompt=MESSAGETYPE.WARNING;
	//log an error message
	cosmos.log.logError("Error: error message");
	//log an informational message and prompt the user with the message
	cosmos.log.logInfo("Error: error message", true);

Globalization

The error handler will not handle internationalization. It is expected that the messages will be translated before logging the message. Messages can be translated using the dojo globalization programming model (http://dojotoolkit.org/book/dojo-book-0-9/part-3-programmatic-dijit-and-dojo/i18n)


Server Side Logging

The default error handler object provides a means for a server side component to recieve error messages from the client. The client will use the post method to send logged messages from the client to the server side error component. The following define the POST arguements sent in the request to the server component

  • message - a string repesentation of the message
  • messagetype - this is a numeric value 1,2 or 4 repesenting an error, informational or warning message


Design Note

Note that the structure of the message is not finalized. The structure of the message is dictated by the overall project error handling strategy.

For example the message structure could model an error code as follows:

{
   errorCode:"MSG010234",
   message: "Connection can not be resolved",
   severity: 40
}

Back to the top