You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a bit of code that, by design, tries to connect to a non-existent database. I expect an error so I put it in a try/catch block, but libpq's red error message is still printed to screen. To be clear, the rest of the code works, it's just a bit annoying that users would see a red message that actually shouldn't be treated as an error.
Even with Suppressor.jl macros or setting throw_error=false, the message still gets through.
Any idea how I could disable that temporarily?
Minimal example:
using LibPQ
try
c = LibPQ.Connection("dbname=x host=/notexists")
catch e
# do nothingend
output (in red):
[error | LibPQ]: connection to server on socket "/notexists/.s.PGSQL.5432" failed: No such file or directory
Is the server running locally and accepting connections on that socket?
The text was updated successfully, but these errors were encountered:
You can either temporarily set the log level for LibPQ.jl for your function:
setlevel!(getlogger("LibPQ"), "critical") do
mything()
end
set the log level globally for your application with a setlevel!(getlogger("LibPQ"), "critical"), or use Memento filters (I'd have to hunt through Memento for a good example of how to do that).
Hi, thanks a lot for this library!
I have a bit of code that, by design, tries to connect to a non-existent database. I expect an error so I put it in a try/catch block, but libpq's red error message is still printed to screen. To be clear, the rest of the code works, it's just a bit annoying that users would see a red message that actually shouldn't be treated as an error.
Even with Suppressor.jl macros or setting
throw_error=false
, the message still gets through.Any idea how I could disable that temporarily?
Minimal example:
output (in red):
The text was updated successfully, but these errors were encountered: