Skip to content

Commit

Permalink
more user-friendly
Browse files Browse the repository at this point in the history
  • Loading branch information
inclyc committed Aug 11, 2024
1 parent d08d5fe commit 52323b0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion nixd/lib/Controller/AST.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ struct VLAException : std::exception {};

struct NoLocationForBuiltinVariable : std::exception {
[[nodiscard]] const char *what() const noexcept override {
return "builtin variable is not defined in nix source location";
return "builtins are defined in the interpreter, not in the Nix files";
}
};

Expand Down
5 changes: 2 additions & 3 deletions nixd/lib/Controller/Definition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,8 @@ defineVar(const ExprVar &Var, const VariableLookupAnalysis &VLA,
return StaticLocs;
}
} catch (std::exception &E) {
// Pop a window, notify the user we cannot find static definition.
// Likely this will be triggerred by clicking "builtins"
return error(E.what());
elog("definition/static: {0}", E.what());
return Locations{};
}
return error("unreachable code! Please submit an issue");
}
Expand Down
6 changes: 3 additions & 3 deletions nixd/tools/nixd/test/definition/builtin.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@
```

```
CHECK: "message": "builtin variable is not defined in nix source location"
CHECK-NEXT: },
CHECK-NEXT: "id": 2,
CHECK: "id": 2,
CHECK-NEXT: "jsonrpc": "2.0",
CHECK-NEXT: "result": null
```


Expand Down

0 comments on commit 52323b0

Please sign in to comment.