better errors when reindexing
* tekuti/index.scm (maybe-reindex): Reindex within a call-with-error-handling.
This commit is contained in:
parent
7a1944b240
commit
f89e4b128b
1 changed files with 10 additions and 10 deletions
|
@ -1,5 +1,5 @@
|
||||||
;; Tekuti
|
;; Tekuti
|
||||||
;; Copyright (C) 2008, 2010 Andy Wingo <wingo at pobox dot com>
|
;; Copyright (C) 2008, 2010, 2012 Andy Wingo <wingo at pobox dot com>
|
||||||
|
|
||||||
;; This program is free software; you can redistribute it and/or
|
;; This program is free software; you can redistribute it and/or
|
||||||
;; modify it under the terms of the GNU General Public License as
|
;; modify it under the terms of the GNU General Public License as
|
||||||
|
@ -26,6 +26,7 @@
|
||||||
|
|
||||||
(define-module (tekuti index)
|
(define-module (tekuti index)
|
||||||
#:use-module ((srfi srfi-1) #:select (fold))
|
#:use-module ((srfi srfi-1) #:select (fold))
|
||||||
|
#:use-module (system repl error-handling)
|
||||||
#:use-module (tekuti util)
|
#:use-module (tekuti util)
|
||||||
#:use-module (tekuti git)
|
#:use-module (tekuti git)
|
||||||
#:use-module (tekuti post)
|
#:use-module (tekuti post)
|
||||||
|
@ -93,15 +94,14 @@
|
||||||
(let ((master (git-rev-parse "refs/heads/master")))
|
(let ((master (git-rev-parse "refs/heads/master")))
|
||||||
(if (equal? (assq-ref old-index 'master) master)
|
(if (equal? (assq-ref old-index 'master) master)
|
||||||
old-index
|
old-index
|
||||||
(catch #t
|
(call-with-error-handling
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(let ((new-index (reindex old-index master)))
|
(let ((new-index (reindex old-index master)))
|
||||||
(acons
|
(acons
|
||||||
'index (write-index new-index (assq-ref old-index 'index))
|
'index (write-index new-index (assq-ref old-index 'index))
|
||||||
new-index)))
|
new-index)))
|
||||||
(lambda (key . args)
|
#:on-error 'backtrace
|
||||||
(warn "error while reindexing:" key args)
|
#:post-error (lambda _ old-index)))))
|
||||||
old-index)))))
|
|
||||||
|
|
||||||
(define (update-index index key update)
|
(define (update-index index key update)
|
||||||
(cond
|
(cond
|
||||||
|
|
Loading…
Reference in a new issue