summaryrefslogtreecommitdiff
path: root/ext/win32ole/win32ole.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/win32ole/win32ole.c')
-rw-r--r--ext/win32ole/win32ole.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/ext/win32ole/win32ole.c b/ext/win32ole/win32ole.c
index 9765929..072638a 100644
--- a/ext/win32ole/win32ole.c
+++ b/ext/win32ole/win32ole.c
@@ -1209,19 +1209,18 @@ static void
ole_raise(HRESULT hr, VALUE ecs, const char *fmt, ...)
{
va_list args;
- char buf[BUFSIZ];
+ VALUE msg;
VALUE err_msg;
va_init_list(args, fmt);
- vsnprintf(buf, BUFSIZ, fmt, args);
+ msg = rb_vsprintf(fmt, args);
va_end(args);
err_msg = ole_hresult2msg(hr);
if(err_msg != Qnil) {
- rb_raise(ecs, "%s\n%s", buf, StringValuePtr(err_msg));
- }
- else {
- rb_raise(ecs, "%s", buf);
+ rb_str_cat2(msg, "\n");
+ rb_str_append(msg, err_msg);
}
+ rb_exc_raise(rb_exc_new_str(ecs, msg));
}
void