static walkDir(checkDir=true) does not raise error
### Description

According to docs, calling `walkDir` with the parameter `checkDir=true` should raise an error if the directory doesn't exist.

This does not happen in a `static` block.

```
# foo.nim
static:
  walkDir("nonexistantdirectory), checkDir=true)

$ nim c foo
# compile successful, no error raised
```



### Nim Version

Nim Compiler Version 2.2.0 [Linux: amd64]
Compiled at 2024-10-02
Copyright (c) 2006-2024 by Andreas Rumpf

git hash: 78983f1876726a49c69d65629ab433ea1310ece1
active boot switches: -d:release


### Current Output

```text
No outputError: unhandled exception: No such file or directory
Additional info: this-should-not-exist [OSError]
```


### Expected Output

```text
Error: unhandled exception: No such file or directory
Additional info: nonexistantdirectory [OSError]
```


### Known Workarounds

Check manually

### Additional Information

_No response_