Share via


Exception Constructors

Definition

Overloads

Exception()

Constructs a new exception with null as its detail message.

Exception(Throwable)

Constructs a new exception with the specified cause and a detail message of (cause==null ? null : cause.toString()) (which typically contains the class and detail message of cause).

Exception(String)

Constructs a new exception with the specified detail message.

Exception(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

Exception(String, Throwable)

Constructs a new exception with the specified detail message and cause.

Exception(String, Throwable, Boolean, Boolean)
Obsolete.

Exception()

Constructs a new exception with null as its detail message.

[Android.Runtime.Register(".ctor", "()V", "")]
public Exception ();
Attributes

Remarks

Constructs a new exception with null as its detail message. The cause is not initialized, and may subsequently be initialized by a call to #initCause.

Java documentation for java.lang.Exception.Exception().

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Exception(Throwable)

Constructs a new exception with the specified cause and a detail message of (cause==null ? null : cause.toString()) (which typically contains the class and detail message of cause).

[Android.Runtime.Register(".ctor", "(Ljava/lang/Throwable;)V", "")]
public Exception (Java.Lang.Throwable? cause);
[<Android.Runtime.Register(".ctor", "(Ljava/lang/Throwable;)V", "")>]
new Java.Lang.Exception : Java.Lang.Throwable -> Java.Lang.Exception

Parameters

cause
Throwable

the cause (which is saved for later retrieval by the #getCause() method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.)

Attributes

Remarks

Constructs a new exception with the specified cause and a detail message of (cause==null ? null : cause.toString()) (which typically contains the class and detail message of cause). This constructor is useful for exceptions that are little more than wrappers for other throwables (for example, java.security.PrivilegedActionException).

Added in 1.4.

Java documentation for java.lang.Exception.Exception(java.lang.Throwable).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Exception(String)

Constructs a new exception with the specified detail message.

[Android.Runtime.Register(".ctor", "(Ljava/lang/String;)V", "")]
public Exception (string? message);
[<Android.Runtime.Register(".ctor", "(Ljava/lang/String;)V", "")>]
new Java.Lang.Exception : string -> Java.Lang.Exception

Parameters

message
String

the detail message. The detail message is saved for later retrieval by the #getMessage() method.

Attributes

Remarks

Constructs a new exception with the specified detail message. The cause is not initialized, and may subsequently be initialized by a call to #initCause.

Java documentation for java.lang.Exception.Exception(java.lang.String).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Exception(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

protected Exception (IntPtr javaReference, Android.Runtime.JniHandleOwnership transfer);
new Java.Lang.Exception : nativeint * Android.Runtime.JniHandleOwnership -> Java.Lang.Exception

Parameters

javaReference
IntPtr

nativeint

A IntPtrcontaining a Java Native Interface (JNI) object reference.

transfer
JniHandleOwnership

A JniHandleOwnershipindicating how to handle javaReference

Remarks

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Exception(String, Throwable)

Constructs a new exception with the specified detail message and cause.

[Android.Runtime.Register(".ctor", "(Ljava/lang/String;Ljava/lang/Throwable;)V", "")]
public Exception (string? message, Java.Lang.Throwable? cause);
[<Android.Runtime.Register(".ctor", "(Ljava/lang/String;Ljava/lang/Throwable;)V", "")>]
new Java.Lang.Exception : string * Java.Lang.Throwable -> Java.Lang.Exception

Parameters

message
String

the detail message (which is saved for later retrieval by the #getMessage() method).

cause
Throwable

the cause (which is saved for later retrieval by the #getCause() method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.)

Attributes

Remarks

Constructs a new exception with the specified detail message and cause.

Note that the detail message associated with cause is not automatically incorporated in this exception's detail message.

Added in 1.4.

Java documentation for java.lang.Exception.Exception(java.lang.String, java.lang.Throwable).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Exception(String, Throwable, Boolean, Boolean)

Caution

This member does not exist on Android. It was erroneously bound.

[System.Obsolete("This member does not exist on Android. It was erroneously bound.", true)]
protected Exception (string p0, Java.Lang.Throwable p1, bool p2, bool p3);
[<System.Obsolete("This member does not exist on Android. It was erroneously bound.", true)>]
new Java.Lang.Exception : string * Java.Lang.Throwable * bool * bool -> Java.Lang.Exception

Parameters

p0
String
p2
Boolean
p3
Boolean
Attributes

Remarks

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to