I use try catch
block in iced coffee script
. I call not existent method fake
of not existent object a
and expect to catch error.
db = require '../../call/db.iced'
try
await db.find "79", defer c, d
a.fake()
catch error
console.log "error catched"
console.log error
But after calling function db.find
a.fake() throw error in console, but it don't use try catch
block as expected.
If I comment out string await db.find "79", defer c, d
...
db = require '../../call/db.iced'
try
# await db.find "79", defer c, d ############## commented out
a.fake()
catch error
console.log "error catched"
console.log error
... it works as expected and error is catched.
I tried to change string await db.find "79", defer c, d
by other simple async functions calles but they works fine and error was catched well.
It is interesting that function db.find
works good. When I comment out string a.fake()
...
db = require '../../call/db.iced'
try
await db.find "79", defer c, d
#a.fake() ################################ commented out
catch error
console.log "error catched"
console.log error
... this script works without any errors and so without catching errors.
Can not figure out why I can not catch error after function await db.find "79", defer c, d
.