nuintun / node-adodb

A node.js javascript client implementing the ADODB protocol on windows.
https://nuintun.github.io/node-adodb
MIT License
185 stars 51 forks source link

Electron node-adodb error description / message is being cut off #123

Closed mseltene closed 5 years ago

mseltene commented 5 years ago

try { const insertedId = await connection.execute(sql,'SELECT @@Identity AS insertedId'); console.log(insertedId) } catch (error) { console.log( JSON.stringify(error.process.code)); // prints the code console.log(JSON.stringify(error.process.message)); // prints the message, but the message is cut off, which the message looking for is the next line. //at the moment it prints out "{process:{code:-2147467259,message:ODBC--insert on a linked table 'Patient_Referral' failed.},exitCode:0}" but the message originally continues to new line saying "[Microsoft][ODBC SQL Server Driver][SQL Server]Failed. Entry already exists on database. Please update/delete instead. (#50000) [Microsoft][ODBC SQL Server Driver][SQL Server]The transaction ended in the trigger. The batch has been aborted. (#3609)" } The error happens when someone tries to insert an entry that is already on database, but at the moment the node-adodb message "ODBC--insert on a linked table 'Patient_Referral' failed." instead of why as well. If console.log(error) is used instead of console.log(JSON.stringify(error)), then "Error: Spawn C:\Windows\SysWOW64\cscript.exe error" is thrown. MS Access handled the error with MsgBox normally describing that the SQL Server rolled back the transaction, but node-adodb removed that message. Please see the below image examples.

msaccess insert error handled thrown instead

Looking forward to resolve this issue soon hopefully, please kindly help.

mseltene commented 5 years ago

I found out that when tables are converted to local, then no problem. This is an issue with MS Access linked data source not sending error messages to the node-adodb or spawn ActiveXObject.