Skip to content

Commit 39c4665

Browse files
committed
Store reason as a field in MissingExperimentalFeature
Store the reason string as a field in the exception class rather than only embedding it in the error message. This supports better structured error handling and future JSON error reporting. Suggested by Ericson2314 in PR review.
1 parent 71aa9a4 commit 39c4665

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

src/libutil/experimental-features.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,7 @@ MissingExperimentalFeature::MissingExperimentalFeature(ExperimentalFeature featu
383383
showExperimentalFeature(feature),
384384
Uncolored(optionalBracket(" (", reason, ")")))
385385
, missingFeature(feature)
386+
, reason{reason}
386387
{
387388
}
388389

src/libutil/include/nix/util/experimental-features.hh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ public:
8888
*/
8989
ExperimentalFeature missingFeature;
9090

91+
std::string reason;
92+
9193
MissingExperimentalFeature(ExperimentalFeature missingFeature, std::string reason = "");
9294
};
9395

0 commit comments

Comments
 (0)