Share via


Error Constructors

Definition

Overloads

Error()

Constructs a new error with null as its detail message.

Error(Throwable)

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

Error(String)

Constructs a new error with the specified detail message.

Error(IntPtr, JniHandleOwnership)

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

Error(String, Throwable)

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

Error(String, Throwable, Boolean, Boolean)

Constructs a new error with the specified detail message, cause, suppression enabled or disabled, and writable stack trace enabled or disabled.

Error()

Constructs a new error with null as its detail message.

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

Remarks

Constructs a new error 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.Error.Error().

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

Error(Throwable)

Constructs a new error 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 Error (Java.Lang.Throwable? cause);
[<Android.Runtime.Register(".ctor", "(Ljava/lang/Throwable;)V", "")>]
new Java.Lang.Error : Java.Lang.Throwable -> Java.Lang.Error

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 error 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 errors that are little more than wrappers for other throwables.

Added in 1.4.

Java documentation for java.lang.Error.Error(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

Error(String)

Constructs a new error with the specified detail message.

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

Parameters

message
String

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

Attributes

Remarks

Constructs a new error 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.Error.Error(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

Error(IntPtr, JniHandleOwnership)

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

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

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

Error(String, Throwable)

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

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

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 error with the specified detail message and cause.

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

Added in 1.4.

Java documentation for java.lang.Error.Error(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

Error(String, Throwable, Boolean, Boolean)

Constructs a new error with the specified detail message, cause, suppression enabled or disabled, and writable stack trace enabled or disabled.

[Android.Runtime.Register(".ctor", "(Ljava/lang/String;Ljava/lang/Throwable;ZZ)V", "", ApiSince=24)]
protected Error (string? message, Java.Lang.Throwable? cause, bool enableSuppression, bool writableStackTrace);
[<Android.Runtime.Register(".ctor", "(Ljava/lang/String;Ljava/lang/Throwable;ZZ)V", "", ApiSince=24)>]
new Java.Lang.Error : string * Java.Lang.Throwable * bool * bool -> Java.Lang.Error

Parameters

message
String

the detail message.

cause
Throwable

the cause. (A null value is permitted, and indicates that the cause is nonexistent or unknown.)

enableSuppression
Boolean

whether or not suppression is enabled or disabled

writableStackTrace
Boolean

whether or not the stack trace should be writable

Attributes

Remarks

Constructs a new error with the specified detail message, cause, suppression enabled or disabled, and writable stack trace enabled or disabled.

Added in 1.7.

Java documentation for java.lang.Error.Error(java.lang.String, java.lang.Throwable, boolean, boolean).

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