NimbleError is now captured in debug mode as well as release mode.
This commit is contained in:
parent
c16c0b8864
commit
60aa57be24
2 changed files with 18 additions and 11 deletions
|
|
@ -420,7 +420,8 @@ proc installFromDir(dir: string, latest: bool, options: Options,
|
||||||
result.pkg = pkgInfo
|
result.pkg = pkgInfo
|
||||||
return result
|
return result
|
||||||
|
|
||||||
echo("Installing ", pkginfo.name, "-", pkginfo.version)
|
display("Installing", "$1 v$2" % [pkginfo.name, pkginfo.version],
|
||||||
|
priority = HighPriority)
|
||||||
|
|
||||||
# Build before removing an existing package (if one exists). This way
|
# Build before removing an existing package (if one exists). This way
|
||||||
# if the build fails then the old package will still be installed.
|
# if the build fails then the old package will still be installed.
|
||||||
|
|
@ -431,7 +432,7 @@ proc installFromDir(dir: string, latest: bool, options: Options,
|
||||||
if existsDir(pkgDestDir) and existsFile(pkgDestDir / "nimblemeta.json"):
|
if existsDir(pkgDestDir) and existsFile(pkgDestDir / "nimblemeta.json"):
|
||||||
if not options.prompt(pkgInfo.name & versionStr &
|
if not options.prompt(pkgInfo.name & versionStr &
|
||||||
" already exists. Overwrite?"):
|
" already exists. Overwrite?"):
|
||||||
quit(QuitSuccess)
|
raise NimbleQuit(msg: "")
|
||||||
removePkgDir(pkgDestDir, options)
|
removePkgDir(pkgDestDir, options)
|
||||||
# Remove any symlinked binaries
|
# Remove any symlinked binaries
|
||||||
for bin in pkgInfo.bin:
|
for bin in pkgInfo.bin:
|
||||||
|
|
@ -1017,15 +1018,18 @@ proc doAction(options: Options) =
|
||||||
|
|
||||||
when isMainModule:
|
when isMainModule:
|
||||||
var error = ""
|
var error = ""
|
||||||
when defined(release):
|
|
||||||
try:
|
try:
|
||||||
parseCmdLine().doAction()
|
|
||||||
except NimbleError:
|
|
||||||
error = getCurrentExceptionMsg()
|
|
||||||
finally:
|
|
||||||
removeDir(getNimbleTempDir())
|
|
||||||
else:
|
|
||||||
parseCmdLine().doAction()
|
parseCmdLine().doAction()
|
||||||
|
except NimbleError:
|
||||||
|
error = getCurrentExceptionMsg()
|
||||||
|
when not defined(release):
|
||||||
|
let stackTrace = getStackTrace(getCurrentException())
|
||||||
|
error = stackTrace & "\n\n" & error
|
||||||
|
except NimbleQuit:
|
||||||
|
nil
|
||||||
|
finally:
|
||||||
|
removeDir(getNimbleTempDir())
|
||||||
|
|
||||||
displayTip()
|
displayTip()
|
||||||
if error.len > 0:
|
if error.len > 0:
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ when not defined(nimscript):
|
||||||
import sets
|
import sets
|
||||||
|
|
||||||
import version
|
import version
|
||||||
export version.NimbleError
|
export version.NimbleError # TODO: Surely there is a better way?
|
||||||
|
|
||||||
type
|
type
|
||||||
BuildFailed* = object of NimbleError
|
BuildFailed* = object of NimbleError
|
||||||
|
|
@ -37,5 +37,8 @@ when not defined(nimscript):
|
||||||
srcDir*: string
|
srcDir*: string
|
||||||
backend*: string
|
backend*: string
|
||||||
|
|
||||||
|
## Same as quit(QuitSuccess), but allows cleanup.
|
||||||
|
NimbleQuit* = ref object of Exception
|
||||||
|
|
||||||
const
|
const
|
||||||
nimbleVersion* = "0.7.11"
|
nimbleVersion* = "0.7.11"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue