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
When odoo server is not working propperly, it can respond anything instaead of data you want.
Like
Internal Server Error
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
^
SyntaxError: Unexpected token <
at Object.parse (native)
at IncomingMessage.<anonymous> (D:\work\a.kuntsevich\Dropbox\work\vnc-project\vnc-proj\service\node_modules\odoo\lib\index.js:53:23)
at emitNone (events.js:72:20)
at IncomingMessage.emit (events.js:166:7)
at endReadableNT (_stream_readable.js:905:12)
at nextTickCallbackWith2Args (node.js:474:9)
at process._tickCallback (node.js:388:17)
[Finished in 0.7s with exit code 1]
It can't be handled with try{} catch{} construction too
But wrapping response = JSON.parse(response); into try{} catch{} can solve this problem:
When odoo server is not working propperly, it can respond anything instaead of data you want.
Like
Instead of json when postgres is down.
Example of code:
Error throwing:
It can't be handled with
try{} catch{}
construction tooBut wrapping
response = JSON.parse(response);
intotry{} catch{}
can solve this problem:in
res.on('end', ...)
will handle the error instead of throwing it:The text was updated successfully, but these errors were encountered: