using System;
using System.Collections.Generic;
using System.Text;
using System.Globalization;

namespace Microsoft.Practices.RecipeFramework.Extensions.CommonHelpers
{
	/// <summary>
	/// Helper class for handling exceptions.
	/// </summary>
	public static class ExceptionHelper
	{
		/// <summary>
		/// Builds the error messsage.
		/// </summary>
		/// <param name="exception">The exception.</param>
		/// <returns></returns>
		public static string BuildErrorMessage(Exception exception)
		{
			string message = string.Empty;

			if (exception != null)
			{
                message = string.Format(CultureInfo.CurrentUICulture, Properties.Resources.InnerExceptionMessage, 
					exception.Message, Environment.NewLine, BuildErrorMessage(exception.InnerException)) ;
			}

			return message;
		}
	}
}
