diff options
author | P. J. McDermott <pj@pehjota.net> | 2016-01-17 16:10:31 (EST) |
---|---|---|
committer | P. J. McDermott <pj@pehjota.net> | 2016-01-17 16:10:31 (EST) |
commit | 09c583248e7c0aa5a833ec01262b8b4a7980234b (patch) | |
tree | e3ecd4028e888d6eb587d9703ace4d90396a624a /src/vardata.sh | |
parent | d5e46c35ea98e43b6ad380ac7fbc197b7881b220 (diff) | |
parent | e3ab87a78aafd979f6eb8bb75ef70304d87a1d6b (diff) |
Merge branch 'feature/improve-error-handling'
Diffstat (limited to 'src/vardata.sh')
-rw-r--r-- | src/vardata.sh | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/vardata.sh b/src/vardata.sh index 05c9cff..6a7e749 100644 --- a/src/vardata.sh +++ b/src/vardata.sh @@ -36,12 +36,14 @@ init_vardata() rand vardatadir="${tmpdir}/${PACKAGE}-$(printf '%010d' ${rand_x})" if ! mkdir "${vardatadir}"; then - error 2 "$(get_msg 'temp_mkdir_fail')" "${vardatadir}" + error "$(get_msg 'temp_mkdir_fail')" "${vardatadir}" + return 1 fi for dir in ${VARDATA_DIRS}; do if ! mkdir "${vardatadir}/${dir}"; then - error 2 "$(get_msg 'temp_mkdir_fail')" \ + error "$(get_msg 'temp_mkdir_fail')" \ "${vardatadir}/${dir}" + return 1 fi done @@ -54,12 +56,14 @@ fini_vardata() for dir in ${VARDATA_DIRS}; do if ! rmdir "${vardatadir}/${dir}"; then - error 2 "$(get_msg 'temp_rmdir_fail')" \ + error "$(get_msg 'temp_rmdir_fail')" \ "${vardatadir}/${dir}" + return 1 fi done if ! rmdir "${vardatadir}"; then - error 2 "$(get_msg 'temp_rmdir_fail')" "${vardatadir}" + error "$(get_msg 'temp_rmdir_fail')" "${vardatadir}" + return 1 fi return 0 |