moved to more borg or restic exit codes solution instead of generalised

This commit is contained in:
Paul Wilde 2024-12-30 22:47:40 +00:00
parent d79780b98b
commit bba41d1225
3 changed files with 17 additions and 18 deletions

View file

@ -1,10 +1,9 @@
import ../model/config_type
import ../model/state_type
import ../model/exit_codes
import ../model/tool_type
import ../notifier/notifier
import ../model/log_type
import exit_codes
import execute
import prune
@ -28,7 +27,7 @@ proc createArchive(nc: NorgConfig, repo: Repository, archivename: string, retry:
return (BORG_ERROR, "Max Retries Reached")
else:
return createArchive(nc, repo, archivename, retry + 1)
return (res.toExitCode(BORG),"Success")
return (res.toExitCode(),"Success")
proc createBackup*(nc: NorgConfig, repo: Repository): EXIT_CODE =
let start_time = now()

15
norg/borg/exit_codes.nim Normal file
View file

@ -0,0 +1,15 @@
import std/enumutils
type
EXIT_CODE* = enum
BORG_SUCCESS = 0
BORG_WARNING = 1
BORG_ERROR = 2
OTHER = 99
proc toExitCode*(i: int): EXIT_CODE =
for code in EXIT_CODE:
if i == ord(code): return code
return OTHER

View file

@ -1,15 +0,0 @@
import tool_type
import std/enumutils
type
EXIT_CODE* = enum
BORG_SUCCESS = 0
BORG_WARNING = 1
BORG_ERROR = 2
OTHER = 99
proc toExitCode*(i: int, tool: BackupTool): EXIT_CODE =
for code in EXIT_CODE:
if i == ord(code): return code
return OTHER