source/Tidings-CommonServices.js
function(pDefaultMessage, pError, pRequest, pResponse, fNext)
		{
			var tmpErrorMessage = pDefaultMessage;
			var tmpErrorCode = 1;
			var tmpScope = null;
			var tmpParams = null;
			var tmpSessionID = null;

			if (typeof(pError) === 'object')
			{
				tmpErrorMessage = pError.Message;
				if (pError.Code)
					tmpErrorCode = pError.Code;
			}
			else if (typeof(pError) === 'string')
			{
				tmpErrorMessage += ' ' + pError;
			}
			if (pRequest.DAL)
			{
				tmpScope = pRequest.DAL.scope;
			}
			if (pRequest.params)
			{
				tmpParams = pRequest.params;
			}
			if (pRequest.UserSession)
			{
				tmpSessionID = pRequest.UserSession.SessionID;
			}

			_Log.warn('API Error: '+tmpErrorMessage, {SessionID: tmpSessionID, RequestID:pRequest.RequestUUID, RequestURL:pRequest.url, Scope: tmpScope, Parameters: tmpParams, Action:'APIError'}, pRequest);
			pResponse.send({Error:tmpErrorMessage, ErrorCode: tmpErrorCode});

			return fNext();
		}
function(pDefaultMessage, pError, pRequest, pResponse, fNext)
		{
			var tmpErrorMessage = pDefaultMessage;
			var tmpErrorCode = 1;
			var tmpScope = null;
			var tmpParams = null;
			var tmpSessionID = null;

			if (typeof(pError) === 'object')
			{
				tmpErrorMessage = pError.Message;
				if (pError.Code)
					tmpErrorCode = pError.Code;
			}
			else if (typeof(pError) === 'string')
			{
				tmpErrorMessage += ' ' + pError;
			}
			if (pRequest.DAL)
			{
				tmpScope = pRequest.DAL.scope;
			}
			if (pRequest.params)
			{
				tmpParams = pRequest.params;
			}
			if (pRequest.UserSession)
			{
				tmpSessionID = pRequest.UserSession.SessionID;
			}

			_Log.warn('API Error: '+tmpErrorMessage, {SessionID: tmpSessionID, RequestID:pRequest.RequestUUID, RequestURL:pRequest.url, Scope: tmpScope, Parameters: tmpParams, Action:'APIError'}, pRequest);
			pResponse.send({Error:tmpErrorMessage, ErrorCode: tmpErrorCode});

			return fNext();
		}
function ( pDefaultMessage , pError , pRequest , pResponse , fNext ) { var tmpErrorMessage = pDefaultMessage ; var tmpErrorCode = 1 ; var tmpScope = null ; var tmpParams = null ; var tmpSessionID = null ; if ( typeof ( pError ) === 'object' ) { tmpErrorMessage = pError . Message ; if ( pError . Code ) tmpErrorCode = pError . Code ; } else if ( typeof ( pError ) === 'string' ) { tmpErrorMessage += ' ' + pError ; } if ( pRequest . DAL ) { tmpScope = pRequest . DAL . scope ; } if ( pRequest . params ) { tmpParams = pRequest . params ; } if ( pRequest . UserSession ) { tmpSessionID = pRequest . UserSession . SessionID ; } _Log . warn ( 'API Error: ' + tmpErrorMessage , { SessionID : tmpSessionID , RequestID : pRequest . RequestUUID , RequestURL : pRequest . url , Scope : tmpScope , Parameters : tmpParams , Action : 'APIError' } , pRequest ) ; pResponse . send ( { Error : tmpErrorMessage , ErrorCode : tmpErrorCode } ) ; return fNext ( ) ; }
Send an Error Code and Error Message to the client, and log it as an error in the log files.

@method sendCodedError
Send an Error Code and Error Message to the client and log it as an error in the log files .