mirror of
https://github.com/logos-storage/logos-storage-nim.git
synced 2026-01-07 16:03:13 +00:00
Provide better message a file is not found
This commit is contained in:
parent
60861d6af8
commit
d85c87c288
@ -9,7 +9,12 @@ in {
|
|||||||
let
|
let
|
||||||
linesFrom = file: splitString "\n" (fileContents file);
|
linesFrom = file: splitString "\n" (fileContents file);
|
||||||
matching = regex: lines: map (line: match regex line) lines;
|
matching = regex: lines: map (line: match regex line) lines;
|
||||||
extractMatch = matches: last (flatten (remove null matches));
|
extractMatch = matches:
|
||||||
|
let xs = flatten (remove null matches);
|
||||||
|
in if xs == [] then
|
||||||
|
throw "findKeyValue: no match for regex '${regex}' in ${toString sourceFile}"
|
||||||
|
else
|
||||||
|
last xs;
|
||||||
in
|
in
|
||||||
extractMatch (matching regex (linesFrom sourceFile));
|
extractMatch (matching regex (linesFrom sourceFile));
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user