Error handling: Difference between revisions

imported>Pogobanane
mNo edit summary
imported>Pogobanane
m mention builtins.unsafeGetAttrPos
Line 68: Line 68:


To summarise debugging approaches discussed in this article, you can use <code>break</code> to debug nix code, <code>breakpointHook</code> to debug nix builds and interactive tools to debug NixOS tests.  
To summarise debugging approaches discussed in this article, you can use <code>break</code> to debug nix code, <code>breakpointHook</code> to debug nix builds and interactive tools to debug NixOS tests.  
Another tool that can be useful to improve error messages is <code>builtins.unsafeGetAttrPos
</code> ([https://github.com/NixOS/nix/blob/b17c4290cf61d8a0386817b87231762c175097c5/tests/lang/eval-okay-getattrpos.nix example]) which returns the line and column of where an attribute is defined. Currently this seems to be limited to attributes defined in the same file though, is undocumented and considered bad practice.


== References ==
== References ==