modify WIN32OLERuntimeError message.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11546 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
suke 2007-01-20 02:28:49 +00:00
Родитель b44bd4c6d3
Коммит e16e6a66ae
4 изменённых файлов: 34 добавлений и 6 удалений

Просмотреть файл

@ -1,3 +1,10 @@
Sat Jan 20 11:18:49 2007 Masaki Suketa <masaki.suketa@nifty.ne.jp>
* ext/win32ole/win32ole.c (ole_invoke, ole_invoke2, ole_propertyput):
modify WIN32OLERuntimeError message.
* test/win32ole/test_win32ole.rb: ditto.
Fri Jan 19 17:12:23 2007 Masaki Suketa <masaki.suketa@nifty.ne.jp>
* ext/win32ole/win32ole.c (Init_win32ole): add WIN32OLE_VARIANT::Empty,

Просмотреть файл

@ -2521,7 +2521,8 @@ ole_invoke(int argc, VALUE *argv, VALUE self, USHORT wFlags, BOOL is_bracket)
if (FAILED(hr)) {
v = ole_excepinfo2msg(&excepinfo);
ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, "%s",
ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, "(in OLE method `%s': )%s",
StringValuePtr(cmd),
StringValuePtr(v));
}
obj = ole_variant2val(&result);
@ -2723,7 +2724,8 @@ ole_invoke2(VALUE self, VALUE dispid, VALUE args, VALUE types, USHORT dispkind)
if (FAILED(hr)) {
v = ole_excepinfo2msg(&excepinfo);
ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, "_invoke %s",
ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, "(in OLE method `<dispatch id:%d>': )%s",
NUM2INT(dispid),
StringValuePtr(v));
}
@ -2907,7 +2909,9 @@ ole_propertyput(VALUE self, VALUE property, VALUE value)
}
if (FAILED(hr)) {
v = ole_excepinfo2msg(&excepinfo);
ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, StringValuePtr(v));
ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, "(in setting property `%s': )%s",
StringValuePtr(property),
StringValuePtr(v));
}
return Qnil;
}

Просмотреть файл

@ -39,6 +39,23 @@ if defined?(WIN32OLE)
}
end
def test_raise_message
exc = assert_raise(WIN32OLERuntimeError) {
@dict1.add
}
assert_match(/^\(in OLE method `add': \)/, exc.message)
exc = assert_raise(WIN32OLERuntimeError) {
@dict1._invoke(1, [], [])
}
assert_match(/^\(in OLE method `<dispatch id:1>': \)/, exc.message)
exc = assert_raise(WIN32OLERuntimeError) {
@dict1.compareMode = 100
}
assert_match(/^\(in setting property `compareMode': \)/, exc.message)
end
def test_ole_methods
methods = @dict1.ole_methods
mnames = methods.collect {|m|

Просмотреть файл

@ -1,7 +1,7 @@
#define RUBY_VERSION "1.9.0"
#define RUBY_RELEASE_DATE "2007-01-19"
#define RUBY_RELEASE_DATE "2007-01-20"
#define RUBY_VERSION_CODE 190
#define RUBY_RELEASE_CODE 20070119
#define RUBY_RELEASE_CODE 20070120
#define RUBY_PATCHLEVEL 0
#define RUBY_VERSION_MAJOR 1
@ -9,7 +9,7 @@
#define RUBY_VERSION_TEENY 0
#define RUBY_RELEASE_YEAR 2007
#define RUBY_RELEASE_MONTH 1
#define RUBY_RELEASE_DAY 19
#define RUBY_RELEASE_DAY 20
RUBY_EXTERN const char ruby_version[];
RUBY_EXTERN const char ruby_release_date[];