Java.Lang.Throwable.FromException Method
Converts a Exception into a Java.Lang.Throwable.

Syntax

public static Throwable FromException (Exception e)

Parameters

e
A Exception to convert to the closest matching Java.Lang.Throwable type.

Returns

A Java.Lang.Throwable.

Exceptions

TypeReason
ArgumentNullException e is null.

Remarks

When e is a Java.Lang.Throwable, then it is returned unchanged.

Otherwise, the class hierachy for e is traversed, looking for the semantically closest matching Java.Lang.Throwable type. For example, ArgumentNullException is mapped to a Java.Lang.IllegalArgumentException. Once a matching type has been found, a new Java.Lang.Throwable instance is created, passing e.Exception.ToString as the constructor argument (which thus requires that the Java.Lang.Throwable type provide a public constructor which accepts a single string argument).

Requirements

Namespace: Java.Lang
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1