Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

transition to cli errors #785

Merged
merged 6 commits into from
Apr 10, 2024
Merged

transition to cli errors #785

merged 6 commits into from
Apr 10, 2024

Conversation

simonpcouch
Copy link
Collaborator

Closes #627.

@@ -14,11 +14,10 @@ OdbcConnection <- function(
timeout = Inf,
dbms.name = NULL,
attributes = NULL,
.connection_string = NULL
.connection_string = NULL,
call = caller_env(2)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using caller_env(2) as caller_env() shows an unhelpful ".local()" frame:

test_con("SQLITE", attributes = list(boop = "bop"))
#> Error in `.local()`:
#> ! `attributes` does not support the connection attribute "boop".
#> ℹ Allowed connection attribute is "azure_token".

with:

 3.   └─odbc::dbConnect(...)
 4.     └─odbc (local) .local(drv, ...)
 5.       └─odbc:::OdbcConnection(...) at odbc/R/dbi-driver.R:184:5

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, S4 adds the intermediate.local wrapper when the arguments of the generic and the method differ in some way. I think it happens here because our method adds the dsn argument before the docs. (No need to change anything, I just thought you might want to know where this was coming from)

R/dbi-driver.R Outdated Show resolved Hide resolved
@simonpcouch simonpcouch requested a review from hadley April 9, 2024 16:54
Copy link
Member

@hadley hadley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good!

R/connection-pane.R Outdated Show resolved Hide resolved
R/dbi-connection.R Outdated Show resolved Hide resolved
R/dbi-driver.R Outdated Show resolved Hide resolved
@@ -14,11 +14,10 @@ OdbcConnection <- function(
timeout = Inf,
dbms.name = NULL,
attributes = NULL,
.connection_string = NULL
.connection_string = NULL,
call = caller_env(2)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, S4 adds the intermediate.local wrapper when the arguments of the generic and the method differ in some way. I think it happens here because our method adds the dsn argument before the docs. (No need to change anything, I just thought you might want to know where this was coming from)

R/odbc-connection.R Outdated Show resolved Hide resolved
R/utils.R Outdated Show resolved Hide resolved
R/utils.R Outdated Show resolved Hide resolved
tests/testthat/_snaps/driver-sqlite.md Outdated Show resolved Hide resolved
tests/testthat/test-utils.R Outdated Show resolved Hide resolved
@simonpcouch simonpcouch merged commit a55ef73 into main Apr 10, 2024
16 checks passed
@simonpcouch simonpcouch deleted the cnd-627 branch April 10, 2024 15:48
call = call
)
}
check_exclusive(table, view, .frame = call)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:chef kiss:

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SUCH A SATISFYING DIFF

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use cli errors
2 participants