diff options
Diffstat (limited to 'csharp/src/Ice/Exception.cs')
-rw-r--r-- | csharp/src/Ice/Exception.cs | 89 |
1 files changed, 30 insertions, 59 deletions
diff --git a/csharp/src/Ice/Exception.cs b/csharp/src/Ice/Exception.cs index 1b3859ffeb0..7bed0aa2c6f 100644 --- a/csharp/src/Ice/Exception.cs +++ b/csharp/src/Ice/Exception.cs @@ -7,7 +7,7 @@ // // ********************************************************************** -using System.Diagnostics; +using System; using System.Globalization; using System.Runtime.Serialization; @@ -35,10 +35,8 @@ namespace Ice /// <summary> /// Base class for Ice exceptions. /// </summary> -#if !SILVERLIGHT - [System.Serializable] -#endif - public abstract class Exception : System.Exception, System.ICloneable + [Serializable] + public abstract class Exception : System.Exception, ICloneable { /// <summary> /// Creates and returns a copy of this exception. @@ -61,20 +59,29 @@ namespace Ice /// <param name="ex">The inner exception.</param> public Exception(System.Exception ex) : base("", ex) {} -#if !SILVERLIGHT /// <summary> /// Initializes a new instance of the exception with serialized data. /// </summary> /// <param name="info">Holds the serialized object data about the exception being thrown.</param> /// <param name="context">Contains contextual information about the source or destination.</param> protected Exception(SerializationInfo info, StreamingContext context) : base(info, context) {} -#endif /// <summary> + /// ice_name() is deprecated, use ice_id() instead. /// Returns the name of this exception. /// </summary> /// <returns>The name of this exception.</returns> - public abstract string ice_name(); + [Obsolete("ice_name() is deprecated, use ice_id() instead.")] + public string ice_name() + { + return ice_id().Substring(2); + } + + /// <summary> + /// Returns the type id of this exception. + /// </summary> + /// <returns>The type id of this exception.</returns> + public abstract string ice_id(); /// <summary> /// Returns a string representation of this exception, including @@ -121,9 +128,7 @@ namespace Ice /// <summary> /// Base class for local exceptions. /// </summary> -#if !SILVERLIGHT - [System.Serializable] -#endif + [Serializable] public abstract class LocalException : Exception { /// <summary> @@ -138,22 +143,18 @@ namespace Ice /// <param name="ex">The inner exception.</param> public LocalException(System.Exception ex) : base(ex) {} -#if !SILVERLIGHT /// <summary> /// Initializes a new instance of the exception with serialized data. /// </summary> /// <param name="info">Holds the serialized object data about the exception being thrown.</param> /// <param name="context">Contains contextual information about the source or destination.</param> protected LocalException(SerializationInfo info, StreamingContext context) : base(info, context) {} -#endif } /// <summary> /// Base class for Ice run-time exceptions. /// </summary> -#if !SILVERLIGHT - [System.Serializable] -#endif + [Serializable] public abstract class SystemException : Exception { /// <summary> @@ -168,22 +169,18 @@ namespace Ice /// <param name="ex">The inner exception.</param> public SystemException(System.Exception ex) : base(ex) {} -#if !SILVERLIGHT /// <summary> /// Initializes a new instance of the exception with serialized data. /// </summary> /// <param name="info">Holds the serialized object data about the exception being thrown.</param> /// <param name="context">Contains contextual information about the source or destination.</param> protected SystemException(SerializationInfo info, StreamingContext context) : base(info, context) {} -#endif } /// <summary> /// Base class for Slice user exceptions. /// </summary> -#if !SILVERLIGHT - [System.Serializable] -#endif + [Serializable] public abstract class UserException : Exception { /// <summary> @@ -198,66 +195,40 @@ namespace Ice /// <param name="ex">The inner exception.</param> public UserException(System.Exception ex) : base(ex) {} -#if !SILVERLIGHT /// <summary> /// Initializes a new instance of the exception with serialized data. /// </summary> /// <param name="info">Holds the serialized object data about the exception being thrown.</param> /// <param name="context">Contains contextual information about the source or destination.</param> protected UserException(SerializationInfo info, StreamingContext context) : base(info, context) {} -#endif - - public virtual void write__(IceInternal.BasicStream os__) - { - os__.startWriteException(null); - writeImpl__(os__); - os__.endWriteException(); - } - - public virtual void read__(IceInternal.BasicStream is__) - { - is__.startReadException(); - readImpl__(is__); - is__.endReadException(false); - } - public virtual void write__(OutputStream os__) + public virtual void iceWrite(OutputStream ostr) { - os__.startException(null); - writeImpl__(os__); - os__.endException(); + ostr.startException(null); + iceWriteImpl(ostr); + ostr.endException(); } - public virtual void read__(InputStream is__) + public virtual void iceRead(InputStream istr) { - is__.startException(); - readImpl__(is__); - is__.endException(false); + istr.startException(); + iceReadImpl(istr); + istr.endException(false); } - public virtual bool usesClasses__() + public virtual bool iceUsesClasses() { return false; } - protected abstract void writeImpl__(IceInternal.BasicStream os__); - protected abstract void readImpl__(IceInternal.BasicStream is__); - - protected virtual void writeImpl__(OutputStream os__) - { - throw new MarshalException("exception was not generated with stream support"); - } - - protected virtual void readImpl__(InputStream is__) - { - throw new MarshalException("exception was not generated with stream support"); - } + protected abstract void iceWriteImpl(OutputStream ostr); + protected abstract void iceReadImpl(InputStream istr); } } namespace IceInternal { - public class RetryException : System.Exception + public class RetryException : Exception { public RetryException(Ice.LocalException ex) { |