suppressWarnings(exp) only suppresses half of the messgage. The part of the warning that is related to the psql error (probably received from the database) cannot be suppressed. E.g
add_user(test_con,"NamE","Email","Password") returns the psql error and an R warning
Error in postgresqlExecStatement(conn, statement, ...) : RS-DBI driver: (could not Retrieve the result : ERROR: relation "users" does not exist LINE 1: INSERT INTO users (name,email,password) values('NamE','Email... ^ )
Warning message: In postgresqlQuickSQL(conn, statement, ...) : Could not create execute: INSERT INTO users (name,email,password) values('NamE','Email','6eb12216e1e7515eda6da7104bccf246') RETURNING user_id;
When suppressing warnings suppressWarnings(add_user(test_con,"NamE","Email","Password")) it still returns the first part:
Error in postgresqlExecStatement(conn, statement, ...) : RS-DBI driver: (could not Retrieve the result : ERROR: relation "users" does not exist LINE 1: INSERT INTO users (name,email,password) values('NamE','Email... ^ )
Add the message returned from postgres to the R warning message rather than in a separate print. (PS it makes my unit test look dirty)
suppressWarnings(exp) only suppresses half of the messgage. The part of the warning that is related to the psql error (probably received from the database) cannot be suppressed. E.g
add_user(test_con,"NamE","Email","Password")
returns the psql error and an R warningError in postgresqlExecStatement(conn, statement, ...) : RS-DBI driver: (could not Retrieve the result : ERROR: relation "users" does not exist LINE 1: INSERT INTO users (name,email,password) values('NamE','Email... ^ )
Warning message: In postgresqlQuickSQL(conn, statement, ...) : Could not create execute: INSERT INTO users (name,email,password) values('NamE','Email','6eb12216e1e7515eda6da7104bccf246') RETURNING user_id;
When suppressing warnings
suppressWarnings(add_user(test_con,"NamE","Email","Password"))
it still returns the first part:Error in postgresqlExecStatement(conn, statement, ...) : RS-DBI driver: (could not Retrieve the result : ERROR: relation "users" does not exist LINE 1: INSERT INTO users (name,email,password) values('NamE','Email... ^ )
Add the message returned from postgres to the R warning message rather than in a separate print. (PS it makes my unit test look dirty)