improve formatting of error message when runnableExamples fails (#16677)
This commit is contained in:
parent
fee5fbc722
commit
7f67c593c1
1 changed files with 6 additions and 1 deletions
|
|
@ -57,6 +57,11 @@ type
|
||||||
|
|
||||||
PDoc* = ref TDocumentor ## Alias to type less.
|
PDoc* = ref TDocumentor ## Alias to type less.
|
||||||
|
|
||||||
|
proc prettyString(a: object): string =
|
||||||
|
# xxx pending std/prettyprint refs https://github.com/nim-lang/RFCs/issues/203#issuecomment-602534906
|
||||||
|
for k, v in fieldPairs(a):
|
||||||
|
result.add k & ": " & $v & "\n"
|
||||||
|
|
||||||
proc presentationPath*(conf: ConfigRef, file: AbsoluteFile, isTitle = false): RelativeFile =
|
proc presentationPath*(conf: ConfigRef, file: AbsoluteFile, isTitle = false): RelativeFile =
|
||||||
## returns a relative file that will be appended to outDir
|
## returns a relative file that will be appended to outDir
|
||||||
let file2 = $file
|
let file2 = $file
|
||||||
|
|
@ -480,7 +485,7 @@ proc runAllExamples(d: PDoc) =
|
||||||
"docCmd", group.docCmd,
|
"docCmd", group.docCmd,
|
||||||
]
|
]
|
||||||
if os.execShellCmd(cmd) != 0:
|
if os.execShellCmd(cmd) != 0:
|
||||||
quit "[runnableExamples] failed: generated file: '$1' group: '$2' cmd: $3" % [outp.string, $group[], cmd]
|
quit "[runnableExamples] failed: generated file: '$1' group: '$2' cmd: $3" % [outp.string, group[].prettyString, cmd]
|
||||||
else:
|
else:
|
||||||
# keep generated source file `outp` to allow inspection.
|
# keep generated source file `outp` to allow inspection.
|
||||||
rawMessage(d.conf, hintSuccess, ["runnableExamples: " & outp.string])
|
rawMessage(d.conf, hintSuccess, ["runnableExamples: " & outp.string])
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue