November Happy Hour will be moved to Thursday December 5th.

Class EPiServerException

Exception that is thrown by EPiServer when a non-fatal error occurs.

Implements
System.Runtime.Serialization.ISerializable
System.Runtime.InteropServices._Exception
Inherited Members
System.Exception.GetBaseException()
System.Exception.ToString()
System.Exception.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)
System.Exception.GetType()
System.Exception.Data
System.Exception.InnerException
System.Exception.TargetSite
System.Exception.StackTrace
System.Exception.HelpLink
System.Exception.Source
System.Exception.HResult
System.Exception.SerializeObjectState
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.MemberwiseClone()
Namespace: EPiServer.Core
Assembly: EPiServer.dll
Version: 11.20.7
Syntax
public class EPiServerException : Exception, ISerializable, _Exception
Remarks

All non-fatal exceptions in EPiServer is derived from this class.

If an exception occurs while translating a message the default message will be displayed instead, otherwise the actual cause of a exception could be hidden.

Examples

Example of throwing a exception with error message translated into different languages, see LocalizationService for more information about adding custom language resources.

throw new EPiServerException("My custom error","/customerror/genericfail");

Constructors

EPiServerException()

Initializes a new instance

Declaration
public EPiServerException()

EPiServerException(SerializationInfo, StreamingContext)

Initializes a new instance with serialized data.

Declaration
protected EPiServerException(SerializationInfo info, StreamingContext context)
Parameters
Type Name Description
System.Runtime.Serialization.SerializationInfo info

The object that holds the serialized object data.

System.Runtime.Serialization.StreamingContext context

The contextual information about the source or destination.

EPiServerException(String)

Initializes a new instance with a specified error message.

Declaration
public EPiServerException(string message)
Parameters
Type Name Description
System.String message

Error message

EPiServerException(String, Exception)

Initializes a new instance with a specified error message and a reference to the inner exception that is the cause of this exception.

Declaration
public EPiServerException(string message, Exception innerException)
Parameters
Type Name Description
System.String message

Error message

System.Exception innerException

The inner exception that is the cause of this exception

EPiServerException(String, String)

Initializes a new instance with a specified error message and a language key passed to LocalizationService for translation.

Declaration
public EPiServerException(string message, string languageKey)
Parameters
Type Name Description
System.String message

Error message

System.String languageKey

Language key passed to LocalizationService for translation

EPiServerException(String, String, Exception)

Initializes a new instance with a specified error message and a reference to the inner exception that is the cause of this exception. And a language key passed to LocalizationService for translation.

Declaration
public EPiServerException(string message, string languageKey, Exception innerException)
Parameters
Type Name Description
System.String message

Error message

System.String languageKey

Language key passed to LocalizationService for translation

System.Exception innerException

The inner exception that is the cause of this exception

EPiServerException(String, String, Exception, String[])

Initializes a new instance with a specified error message and a reference to the inner exception that is the cause of this exception. And a language key passed to LocalizationService for translation.

Declaration
public EPiServerException(string message, string languageKey, Exception innerException, params string[] list)
Parameters
Type Name Description
System.String message

Error message

System.String languageKey

Language key passed to LocalizationService for translation

System.Exception innerException

The inner exception that is the cause of this exception

System.String[] list

Parameter list to substitute values in error text using System.String.Format(System.String,System.Object[])

EPiServerException(String, String, String[])

Initializes a new instance with a specified error message and a language key passed to LocalizationService for translation.

Declaration
public EPiServerException(string message, string languageKey, params string[] list)
Parameters
Type Name Description
System.String message

Error message

System.String languageKey

Language key passed to LocalizationService for translation

System.String[] list

Parameter list to substitute values in error text using System.String.Format(System.String,System.Object[])

Properties

Message

Error message describing current exception

Declaration
public override string Message { get; }
Property Value
Type Description
System.String

The actual error message which can be language dependent if a language key was passed to the exception

Overrides
System.Exception.Message

Methods

ChangeSettings(String, String, String[])

Provide derived classes a way to modify inner state of the exception.

Declaration
protected void ChangeSettings(string message, string languageKey, params string[] list)
Parameters
Type Name Description
System.String message

The error message for this exception

System.String languageKey

Language key passed to LocalizationService for translation

System.String[] list

Parameter list to substitute values in error text using System.String.Format(System.String,System.Object[])

Remarks

This method is used internally by EPiServerException to store information about a thrown exception

Implements

System.Runtime.Serialization.ISerializable
System.Runtime.InteropServices._Exception

Extension Methods