about summary refs log tree commit diff stats
path: root/worker
diff options
context:
space:
mode:
Diffstat (limited to 'worker')
-rw-r--r--worker/notmuch/worker.go25
1 files changed, 22 insertions, 3 deletions
diff --git a/worker/notmuch/worker.go b/worker/notmuch/worker.go
index be213bf..ef4d4bf 100644
--- a/worker/notmuch/worker.go
+++ b/worker/notmuch/worker.go
@@ -32,6 +32,7 @@ type worker struct {
 	uidStore            *uidstore.Store
 	nameQueryMap        map[string]string
 	db                  *notmuch.DB
+	setupErr            error
 	currentSortCriteria []*types.SortCriterion
 }
 
@@ -69,6 +70,14 @@ func (w *worker) err(msg types.WorkerMessage, err error) {
 	}, nil)
 }
 func (w *worker) handleMessage(msg types.WorkerMessage) error {
+	if w.setupErr != nil {
+		// only configure can recover from a config error, bail for everything else
+		_, isConfigure := msg.(*types.Configure)
+		if !isConfigure {
+			return w.setupErr
+		}
+	}
+
 	switch msg := msg.(type) {
 	case *types.Unsupported:
 		// No-op
@@ -109,6 +118,15 @@ func (w *worker) handleMessage(msg types.WorkerMessage) error {
 }
 
 func (w *worker) handleConfigure(msg *types.Configure) error {
+	var err error
+	defer func() {
+		if err == nil {
+			w.setupErr = nil
+			return
+		}
+		w.setupErr = fmt.Errorf("notmuch: %v", err)
+	}()
+
 	u, err := url.Parse(msg.Config.Source)
 	if err != nil {
 		w.w.Logger.Printf("error configuring notmuch worker: %v", err)
@@ -120,8 +138,9 @@ func (w *worker) handleConfigure(msg *types.Configure) error {
 	}
 	pathToDB := filepath.Join(home, u.Path)
 	w.uidStore = uidstore.NewStore()
-	if err = w.loadQueryMap(msg.Config); err != nil {
-		return fmt.Errorf("could not load query map: %v", err)
+	err = w.loadQueryMap(msg.Config)
+	if err != nil {
+		return fmt.Errorf("could not load query map configuration: %v", err)
 	}
 	excludedTags := w.loadExcludeTags(msg.Config)
 	w.db = notmuch.NewDB(pathToDB, excludedTags, w.w.Logger)
@@ -393,7 +412,7 @@ func (w *worker) loadQueryMap(acctConfig *config.AccountConfig) error {
 
 		split := strings.SplitN(line, "=", 2)
 		if len(split) != 2 {
-			return fmt.Errorf("invalid line %q, want name=query", line)
+			return fmt.Errorf("%v: invalid line %q, want name=query", file, line)
 		}
 		w.nameQueryMap[split[0]] = split[1]
 	}
t; 2016-03-31 21:05:02 +0100 committer James Booth <boothj5@gmail.com> 2016-03-31 21:05:02 +0100 Removed #AX_PREFIX_CONFIG_H' href='/danisanti/profani-tty/commit/src/main.c?id=9b177a9e0156bae0a7a01cb15b3afc982dd2582e'>9b177a9e ^
17488ca3 ^
9b55f2de ^
a4cadf78 ^
7c908780 ^
9b177a9e ^
0fbaa6f5 ^
6b852a2f ^
fc5bfb7d ^
ca1dcdda ^







17b4e45c ^



9b55f2de ^
a4cadf78 ^

581f58e4 ^
7c908780 ^
a2726b6a ^




7c908780 ^
279737ba ^
a2726b6a ^
6bad38c2 ^
f2159559 ^
5e99a791 ^






e0dfe483 ^

a2726b6a ^
7c908780 ^
034a9858 ^
b8207207 ^
75cfe388 ^
46e938b6 ^
4f19ea26 ^
7c908780 ^

6bad38c2 ^
a2726b6a ^

72d96a92 ^
7c908780 ^

7c908780 ^

c9ed5834 ^
98bc1abb ^
72d96a92 ^
7c908780 ^
72d96a92 ^
453fcae2 ^

7c908780 ^
9b177a9e ^


6b852a2f ^
9b177a9e ^
6b852a2f ^

9b177a9e ^
6b852a2f ^

13088e0a ^

8c08e64f ^
14c8f53f ^
7c908780 ^


0115d71e ^


651d5aaa ^
2b88e2f1 ^
2b88e2f1 ^
e434b1bb ^
651d5aaa ^




9b177a9e ^
a2726b6a ^
ca1dcdda ^
0115d71e ^



9b177a9e ^
a2726b6a ^
ca1dcdda ^
2490c3ed ^



249701fe ^





9b177a9e ^
bd928f0f ^




9b177a9e ^
a2726b6a ^
17b4e45c ^

2783c84a ^



697db019 ^
791b13cb ^
1e60d17d ^
791b13cb ^
1e60d17d ^

7c908780 ^
72d96a92 ^

b8207207 ^

d18ec23d ^

c9fcd018 ^



4f19ea26 ^
5d9c7ffd ^


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190