Skip to content

Commit

Permalink
Merge pull request #517 from cmacdonald/signature_exception
Browse files Browse the repository at this point in the history
make signature exception more useful
  • Loading branch information
tshirtman authored Apr 21, 2020
2 parents 1ab9573 + f9d5e4b commit 97b0dd3
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions jnius/jnius_export_class.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,7 @@ cdef class JavaMethod(object):

if self.j_method == NULL:
raise JavaException('Unable to find the method'
' {0}({1})'.format(self.name, self.definition))
' {0}({1}) in {2}'.format(self.name, self.definition, self.classname))

cdef void set_resolve_info(self, JNIEnv *j_env, jclass j_cls,
LocalRef j_self, name, classname):
Expand Down Expand Up @@ -823,7 +823,9 @@ cdef class JavaMethod(object):
if len(args) != d_args_len:
raise JavaException(
'Invalid call, number of argument mismatch, '
'got {} need {}'.format(len(args), d_args_len)
'got {} need {}, found definitions {} in class {} method {}'.format(
len(args), d_args_len, str(self.definition_args),
self.classname, self.name)
)

if not self.is_static and j_env == NULL:
Expand Down Expand Up @@ -1117,7 +1119,8 @@ cdef class JavaMultipleMethod(object):

if not scores:
raise JavaException(
'No methods matching your arguments, available: {}'.format(
'No methods matching your arguments, requested: {}, available: {}'.format(
args,
found_signatures
)
)
Expand Down

0 comments on commit 97b0dd3

Please sign in to comment.