From ch|r|com @end|ng |rom goog|e@com  Thu Aug 10 05:01:57 2023
From: ch|r|com @end|ng |rom goog|e@com (Michael Chirico)
Date: Wed, 9 Aug 2023 20:01:57 -0700
Subject: [Rd] Improving user-friendliness of S4 dispatch failure when
 mis-naming arguments?
Message-ID: <CAD7Bkx8Y44Gy=sW+mMfyXqpg3gcGKojS9A0zbrHzF_qqJsvYAg@mail.gmail.com>

I fielded a debugging request from a non-expert user today. At root
was running the following:

dbGetQuery(connection = conn, query = query)

The problem is that they've named the arguments incorrectly -- it
should have been [1]:

dbGetQuery(conn = conn, statement = query)

The problem is that the error message "looks" highly confusing to the
untrained eye:

Error in (function (classes, fdef, mtable)  :   unable to find an
inherited method for function ?dbGetQuery? for signature ?"missing",
"missing"?

In retrospect, of course, this makes sense -- the mis-named arguments
are getting picked up by '...', leaving the required arguments
missing.

But I was left wondering how we could help users right their own ship here.

Would it help to mention the argument names? To include some code
checking for weird combinations of missing arguments? Any other
suggestions?

Mike C

[1] https://github.com/r-dbi/DBI/blob/97934c885749dd87a6beb10e8ccb6a5ebea3675e/R/dbGetQuery.R#L62-L64



[Rd] Improving user-friendliness of S4 dispatch failure when mis-naming arguments?
Michael Chirico