Skip to content

Commit 959562b

Browse files
committed
Refactor to cleanly exit even when function crashes on connect_to_etn()
1 parent 0bb9cef commit 959562b

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

R/validate_login.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ validate_login <- function(username, password) {
2222

2323
tryCatch(
2424
{
25-
connection <- connect_to_etn(username, password)
26-
DBI::dbDisconnect(connection)
25+
connection <-
26+
withr::local_db_connection(connect_to_etn(username, password))
2727
return(TRUE)
2828
},
2929
error = function(e) {

0 commit comments

Comments
 (0)