Skip to content

Commit d78ea64

Browse files
committed
i think this will close #6
1 parent 18090b5 commit d78ea64

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

examples/type-n-search/src/app.jsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,20 @@ const MostTypeNSearch = connect(function(intent$){
2828
.map(url=>rest(url).then(resp=>({
2929
type: 'dataUpdate',
3030
value: resp.entity
31-
})))
31+
})).catch(error=>{
32+
console.error('API REQUEST ERROR:', error)
33+
return {
34+
type: 'dataError',
35+
value: error.message
36+
}
37+
}))
3238
.flatMap(most.fromPromise)
3339
.filter(i=>i.type=='dataUpdate')
3440
.map(data=>JSON.parse(data.value).items)
3541
.map(items=>items.slice(0,10))
3642
.map(items=>state=>({results: items}))
3743
.flatMapError(error=>{
38-
console.log('[ERROR]:', error);
44+
console.log('[CRITICAL ERROR]:', error);
3945
return most.of({message:error.error,className:'display'})
4046
.merge(most.of({className:'hidden'}).delay(3000))
4147
.map(error=>state=>({error}))

0 commit comments

Comments
 (0)