mirror of
https://github.com/logos-storage/logos-storage-nim.git
synced 2026-01-02 13:33:10 +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
|
||||
linesFrom = file: splitString "\n" (fileContents file);
|
||||
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
|
||||
extractMatch (matching regex (linesFrom sourceFile));
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user