Display suppressed messages tip only when an error occurred.

This commit is contained in:
Dominik Picheta 2016-12-21 22:18:11 +01:00
commit 9be27cd665
3 changed files with 5 additions and 5 deletions

View file

@ -78,13 +78,13 @@ proc refresh(options: Options) =
downloadFile(url, tempPath, proxy = getProxy(options))
except:
let message = "Could not download: " & getCurrentExceptionMsg()
display("Warning", message, Warning)
display("Warning:", message, Warning)
lastError = message
continue
if not validatePackagesList(tempPath):
lastError = "Downloaded packages.json file is invalid"
display("Warning", lastError & ", discarding.", Warning)
display("Warning:", lastError & ", discarding.", Warning)
continue
copyFile(tempPath,
@ -1035,7 +1035,7 @@ when isMainModule:
finally:
removeDir(getNimbleTempDir())
displayTip()
if error.len > 0:
displayTip()
display("Error", error, Error, HighPriority)
quit(1)

View file

@ -178,7 +178,7 @@ proc findNimbleFile*(dir: string; error: bool): string =
raise newException(NimbleError,
"Specified directory does not contain a .nimble file.")
else:
display("Warning", "No .nimble file found for " & dir, Warning,
display("Warning:", "No .nimble file found for " & dir, Warning,
HighPriority)
proc getInstalledPkgsMin*(libsDir: string, options: Options):

View file

@ -262,7 +262,7 @@ proc getInstalledPkgs*(libsDir: string, options: Options):
let exc = (ref ValidationError)(getCurrentException())
exc.msg = createErrorMsg(validationErrorMsg, path, exc.msg)
if exc.warnInstalled:
display("Warning", exc.msg, Warning, HighPriority)
display("Warning:", exc.msg, Warning, HighPriority)
else:
raise exc
except: