aboutsummaryrefslogtreecommitdiff
path: root/src/embind/embind.js
diff options
context:
space:
mode:
authorJukka Jylänki <jujjyl@gmail.com>2013-04-17 07:54:00 +0300
committerJukka Jylänki <jujjyl@gmail.com>2013-04-18 20:08:37 +0300
commit94f9f007a444181386ee7fe2b4cb01be93ebe48f (patch)
tree1d6f8db29803c939db7cd91975e898f56f0ceffa /src/embind/embind.js
parentf3c28a7b9aac81b67619378c67f72e8cbc0254b0 (diff)
Improve error messages from embind pointer marshalling and remove TODOs in embind test code.
Diffstat (limited to 'src/embind/embind.js')
-rwxr-xr-xsrc/embind/embind.js21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/embind/embind.js b/src/embind/embind.js
index 42aff0c4..205d7fdc 100755
--- a/src/embind/embind.js
+++ b/src/embind/embind.js
@@ -820,8 +820,11 @@ var genericPointerToWireType = function(destructors, handle) {
}
}
- if (!handle.$$ || !handle.$$.ptr) {
- throwBindingError('Cannot pass deleted or null object');
+ if (!handle.$$) {
+ throwBindingError('Cannot pass "' + _embind_repr(handle) + '" as a ' + this.name);
+ }
+ if (!handle.$$.ptr) {
+ throwBindingError('Cannot pass deleted object as a pointer of type ' + this.name);
}
// TODO: this is not strictly true
@@ -881,8 +884,11 @@ var nonConstNoSmartPtrRawPointerToWireType = function(destructors, handle) {
return 0;
}
- if (!handle.$$ || !handle.$$.ptr) {
- throwBindingError('Cannot pass deleted or null object');
+ if (!handle.$$) {
+ throwBindingError('Cannot pass "' + _embind_repr(handle) + '" as a ' + this.name);
+ }
+ if (!handle.$$.ptr) {
+ throwBindingError('Cannot pass deleted object as a pointer of type ' + this.name);
}
if (handle.$$.ptrType.isConst) {
throwBindingError('Cannot convert argument of type ' + handle.$$.ptrType.name + ' to parameter type ' + this.name);
@@ -900,8 +906,11 @@ var constNoSmartPtrRawPointerToWireType = function(destructors, handle) {
return 0;
}
- if (!handle.$$ || !handle.$$.ptr) {
- throwBindingError('Cannot pass deleted or null object');
+ if (!handle.$$) {
+ throwBindingError('Cannot pass "' + _embind_repr(handle) + '" as a ' + this.name);
+ }
+ if (!handle.$$.ptr) {
+ throwBindingError('Cannot pass deleted object as a pointer of type ' + this.name);
}
var handleClass = handle.$$.ptrType.registeredClass;
var ptr = upcastPointer(handle.$$.ptr, handleClass, this.registeredClass);