```js
(TypeScript is transpiled into JavaScript before it is deployed, so there should be no difference)
15 Replies
i'm using that later method, that said...i've used D1 in alpha and had it working in another part of my code block which I'm reviewing. I have added "vars" to my toml which is one change. Reviewing now the other feature in this project to see if it stopped working. But that said, the try/catch should be showing some sort of error in the console to possible describe what is happening and its not for some reason
so just trying to see if there is some unknown set up issue that is not documented. In my code from about 4 days ago that is in production that is running the alpha, i could see entries being made last night so it was still running. Right now this is all in my dev channel of code
standby..running some more tests. If i print the statement earlier in my codeblock its show...seeing where it stops
okay...couple notes!
i was messing up and forgot to add an "await" to for when I called the a function i set up for testing...oops
so now things are operating kinda
i can see the PRAGMA table_list
however when an error should be generated via the try catch, the error is only showing:
{}
and no information is i the error
(was testing the alpha) now going back to the beta
@Matt did you make any changes, i'm now seeing database entries inserted. HOWEVER, in my console logs of the try catch, even though its inserting its still catching an error however the error message isn't showing, it just shows: {}
Zero changes. I can’t change your code.
i am asking if changes were made to d1
No, we don’t make changes like that.
okay, any idea why an error message is triggering but not showing?
the code block looks like this, one second:
Without seeing your code: no. It’s hard to debug if you are only giving part of the code - just like the
await
issue above, which wasn’t in the code you shared .(my appologies for that)
let me just give you a small piece of code
as mentioned, this block actually does insert into the database but also is triggering a "catch" error however when printing out "e" it just prints out: {}
also note the reason why it wasn't inserting before is that i haad forggoten to add a value in the binding...that said, it still possibly should have triggered an error message to say that
And so you see the output from:
... but NOT:
correct I am seeing ERROR MESSAGE
my assumption is that there should be something in there
correct I am seeing ERROR MESSAGE
BUT...this: console.log(JSON.stringify(e)) is only printing: {}
my assumption is that there should be something in there
What version of wrangler are you using?
i was using 3.9
D1 client API · Cloudflare D1 docs
As part of our Client API, both static and prepared statements are supported. Best practice is to use prepared statements which are precompiled …
okay I guess I just was assuming e would include all the json error messaging...but you are right it doesn't
when i explicitly state e.message it then shows me the error...okay...thanks for gtting this all lined up...i will continue messing around, thank you Matt
(sorry for being a pain in your ass...if you are in santa monica i owe you lunch, thanks for your patience!)
Ha, no problems - happy to help. On the wrong side of the country (NYC) unfortunately!
ahh got it, i learned something new! Thanks