mirror of
https://github.com/cefsharp/CefSharp.git
synced 2026-12-06 04:00:07 +00:00
Implemented exception handling if the property cannot be read. Not 100% sure about this one, but in some way it feels best to propagate a CLR exception into the exception output variable.
This commit is contained in:
committed by
Per Lundberg
parent
11092e383c
commit
f5b2ce92d3
@@ -21,22 +21,31 @@ namespace CefSharp
|
||||
CefString& exception) override
|
||||
{
|
||||
auto unmanagedWrapper = static_cast<UnmanagedWrapper*>(object->GetUserData().get());
|
||||
String^ clrName = toClr(name);
|
||||
auto clrName = toClr(name);
|
||||
PropertyInfo^ property;
|
||||
|
||||
if (unmanagedWrapper->Properties->TryGetValue(clrName, property))
|
||||
{
|
||||
Object^ wrappedObject = unmanagedWrapper->Get();
|
||||
if(wrappedObject == nullptr)
|
||||
auto wrappedObject = unmanagedWrapper->Get();
|
||||
|
||||
if (wrappedObject == nullptr)
|
||||
{
|
||||
exception = "Binding's CLR object is null.";
|
||||
return true;
|
||||
}
|
||||
|
||||
Object^ clrValue = property->GetValue(wrappedObject, nullptr);
|
||||
try
|
||||
{
|
||||
auto clrValue = property->GetValue(wrappedObject, nullptr);
|
||||
|
||||
retval = convertToCef(clrValue, nullptr);
|
||||
return true;
|
||||
retval = convertToCef(clrValue, nullptr);
|
||||
return true;
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
exception = toNative(e->Message);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user