Skip to content

Commit c002df3

Browse files
committed
Include InnerException when ClearScript can't be initialised
1 parent 6f26ae9 commit c002df3

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/React.Core/Exceptions/ClearScriptV8InitialisationException.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ public class ClearScriptV8InitialisationException : ReactException
2121
/// <summary>
2222
/// Initializes a new instance of the <see cref="ClearScriptV8InitialisationException"/> class.
2323
/// </summary>
24-
public ClearScriptV8InitialisationException(string innerMessage) :
25-
base(GetMessage(innerMessage)) { }
24+
public ClearScriptV8InitialisationException(Exception innerException) :
25+
base(GetMessage(innerException), innerException) { }
2626

2727
/// <summary>
2828
/// Used by deserialization
@@ -33,15 +33,15 @@ protected ClearScriptV8InitialisationException(SerializationInfo info, Streaming
3333
/// <summary>
3434
/// Gets a message that describes the current exception.
3535
/// </summary>
36-
private static string GetMessage(string innerMessage)
36+
private static string GetMessage(Exception innerException)
3737
{
3838
return
3939
"Failed to initialise ClearScript V8. This is most likely caused by the native libraries " +
4040
"(ClearScriptV8-64.dll and v8-x64.dll) missing from your app's Bin directory, or the " +
4141
"Visual C++ runtime not being installed. Please ensure your app is referencing the " +
4242
"JavaScriptEngineSwitcher.V8 NuGet package, and refer to the ReactJS.NET site for more" +
4343
"debugging tips.\n\n" +
44-
"More details: " + innerMessage;
44+
"More details: " + innerException.Message;
4545
}
4646
}
4747
}

src/React.Core/JavaScriptEngineFactory.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ private static Func<IJsEngine> GetFactory(IEnumerable<Registration> availableFac
234234
if (JavaScriptEngineUtils.EnvironmentSupportsClearScript())
235235
{
236236
JavaScriptEngineUtils.EnsureEngineFunctional<V8JsEngine, ClearScriptV8InitialisationException>(
237-
ex => new ClearScriptV8InitialisationException(ex.Message)
237+
ex => new ClearScriptV8InitialisationException(ex)
238238
);
239239
}
240240
else if (JavaScriptEngineUtils.EnvironmentSupportsVroomJs())

0 commit comments

Comments
 (0)