summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/com_dotnet/com_dotnet.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/ext/com_dotnet/com_dotnet.c b/ext/com_dotnet/com_dotnet.c
index b45bce0228..e6f92c155a 100644
--- a/ext/com_dotnet/com_dotnet.c
+++ b/ext/com_dotnet/com_dotnet.c
@@ -179,7 +179,10 @@ PHP_FUNCTION(com_dotnet_create_instance)
if (ret == FAILURE) {
char buf[1024];
- sprintf(buf, "Failed to instantiate .Net object [%s]", where);
+ char *err = php_win_err(hr);
+ snprintf(buf, sizeof(buf), "Failed to instantiate .Net object [%s] %s", where, err);
+ if (err)
+ LocalFree(err);
php_com_throw_exception(hr, buf TSRMLS_CC);
ZVAL_NULL(object);
return;