Ejemplo n.º 1
0
        /// <summary>
        /// Configure the error message object that will contain the default user friendly language enabled
        /// message. The method is used with exceptions that do not derive from the BusinessException class.
        /// This exceptions can be considered ASP.NET platform excepions that are not captured by this
        /// application. For example, unable to conntect to database exception. In such cases a generic message
        /// is sent to the client.
        /// </summary>
        /// <param name="actionExecutedContext">HttpActionExecutedContext object</param>
        ///
        private HttpContent GetDefaultDetailedErrorMessage(HttpActionExecutedContext actionExecutedContext)
        {
            var errorMessage = new ErrorMessage
            {
                TechDetails = GetTechnicalDetails(actionExecutedContext),
                Message     = LanguageTranslator.Translate(ResourceManager.GetResourceKeyString(ErrorMessageKeys.DefaultErrorMessage), ResourceType.Error)
            };

            return(new StringContent(JsonConvert.SerializeObject(errorMessage)));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Get the main user friendly language enabled error message that will be used by the client application.
        /// </summary>
        /// <param name="actionExecutedContext">HttpActionExecutedContext object</param>
        ///
        private string GetMainErrorMessage(HttpActionExecutedContext actionExecutedContext)
        {
            var exception = actionExecutedContext.Exception;

            return(LanguageTranslator.Translate(ErrorMessagePackager.GetResourceKeyString(exception), ResourceType.Error));
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Default main error message.
 /// </summary>
 ///
 private string GetDefaultMainErrorMessage()
 {
     return(LanguageTranslator.Translate(ResourceManager.GetResourceKeyString(ErrorMessageKeys.DefaultErrorMessage), ResourceType.Error));
 }