Bogdan Biv
Bogdan Biv
DDeno
Created by Stokestack on 7/22/2024 in #help
mkdirsync is throwing an exception that can't be caught?
deno <params> -> makes your problem easy to cut into smaller pieces
14 replies
DDeno
Created by Stokestack on 7/22/2024 in #help
mkdirsync is throwing an exception that can't be caught?
I mean do try to run your code in console (CMD on windows, iTerm on Mac, or some terminal emulator on linux)
14 replies
DDeno
Created by Stokestack on 7/22/2024 in #help
mkdirsync is throwing an exception that can't be caught?
Yeah, do validate your code independent of the tool you use
14 replies
DDeno
Created by Stokestack on 7/22/2024 in #help
mkdirsync is throwing an exception that can't be caught?
If validateEnvironment() works in the code as you write it, it means you have defined it before. Otherwise validateEnvironment() {} is actually two unrelated pieces of code. It will be interpreted as: ``javascript validateEnvironment(); /// call to some non existing function { /// some unrelated code }
14 replies
DDeno
Created by Stokestack on 7/22/2024 in #help
mkdirsync is throwing an exception that can't be caught?
I'm not sure how you tried it, do you have an asciinema or such?
14 replies
DDeno
Created by Stokestack on 7/22/2024 in #help
mkdirsync is throwing an exception that can't be caught?
So which version of deno are you using? Mine is: deno 1.45.2
14 replies
DDeno
Created by Stokestack on 7/22/2024 in #help
mkdirsync is throwing an exception that can't be caught?
IMO, I'm not sure exactly what's going on in your code but you seem to have dropped the function keyword from the code (before the body function). I'm not experienced at all, it's just my 0.02$
14 replies
DDeno
Created by Stokestack on 7/22/2024 in #help
mkdirsync is throwing an exception that can't be caught?
This code does throw (prints AlreadyExists on console): deno run --allow-write=./new_dir main.ts #main.ts try {Deno.mkdirSync("new_dir");} catch (error) {console.log(error.name)} Of course on the first run it does not print out anything, further reruns do print AlreadyExists Also works: function validateEnvironment() { try {Deno.mkdirSync("new_dir");} catch (error) {console.log(error.name)}; } // validateEnvironment();
14 replies