We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 3fcdccb + e3873aa commit 1dc7e6cCopy full SHA for 1dc7e6c
1 file changed
src/libflake/flake/lockfile.cc
@@ -108,8 +108,13 @@ LockFile::LockFile(
108
const fetchers::Settings & fetchSettings,
109
std::string_view contents, std::string_view path)
110
{
111
- auto json = nlohmann::json::parse(contents);
112
-
+ auto json = [=] {
+ try {
113
+ return nlohmann::json::parse(contents);
114
+ } catch (const nlohmann::json::parse_error & e) {
115
+ throw Error("Could not parse '%s': %s", path, e.what());
116
+ }
117
+ }();
118
auto version = json.value("version", 0);
119
if (version < 5 || version > 7)
120
throw Error("lock file '%s' has unsupported version %d", path, version);
0 commit comments