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
If sql.begin is called and throw error (database not reachable, impossible to connect, ...), the error is not able to be captured by try/catch.
Example : I try to run this sql script but the sql server is not available (I don't run the service) :
try{constsql=postgres(config);awaitsql.begin(async(sql)=>{awaitsql`insert into test (label, value) values (${measure.label}, ${measure.value})`});awaitsql.end();}catch(err){console.log('error catched');console.error(err);}
Code inside sql.begin and after it is never called and the catch part is never called. Otherwise we got this nodeJS error :
(node:13328) UnhandledPromiseRejectionWarning: Error: connect ECONNREFUSED 127.0.0.1:5432
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16)
(node:13328) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
Informations
Node.js version : 14.15.4
postgres version : 1.0.2
The text was updated successfully, but these errors were encountered:
If
sql.begin
is called and throw error (database not reachable, impossible to connect, ...), the error is not able to be captured bytry
/catch
.Example : I try to run this sql script but the sql server is not available (I don't run the service) :
Code inside
sql.begin
and after it is never called and the catch part is never called. Otherwise we got this nodeJS error :Informations
14.15.4
1.0.2
The text was updated successfully, but these errors were encountered: