Skip to content

Commit f5b6367

Browse files
committed
[[nodejs-ssb]] but with popular query.
1 parent 9a24f39 commit f5b6367

File tree

3 files changed

+25
-9
lines changed

3 files changed

+25
-9
lines changed

src/core/platforms/nodejs-ssb/ssb.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1620,9 +1620,16 @@ class NodeJsSSB {
16201620
pull.take(Math.min(length, maxMessages)),
16211621
pull.map(([key]) => key),
16221622
pullParallelMap(async (key, cb) => {
1623-
const msg = await this.get(key)
1624-
const data = { key: key, value: msg }
1625-
cb(null, data)
1623+
try {
1624+
const msg = await this.get(key)
1625+
const data = { key: key, value: msg }
1626+
cb(null, data)
1627+
}catch(n){
1628+
// something bad happened.
1629+
console.log(key)
1630+
console.error(`error getting msg`, n)
1631+
cb(null, null)
1632+
}
16261633
}),
16271634
followingFilter,
16281635
pull.apply(pull, pipeline),
@@ -1671,6 +1678,9 @@ class NodeJsSSB {
16711678
.map(([key]) => key)
16721679

16731680
return pull.filter((message) => {
1681+
if (!message?.value) {
1682+
return false
1683+
}
16741684
if (message.value.author === id) {
16751685
return me !== false
16761686
} else {

src/packages/errorHandler/ErrorView.svelte

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script>
2-
document.title = `Patchfox - Error`
2+
patchfox.title(`Oops!`)
33
44
export let error = {}
55
export let currentPackage = {}
@@ -10,6 +10,7 @@
1010
let cta = false
1111
1212
console.log(error)
13+
1314
if (typeof error == "object") {
1415
errorObj = error
1516
error = errorObj.message
@@ -26,15 +27,18 @@
2627
if (errorMapping.hasOwnProperty(error)) {
2728
cta = errorMapping[error]
2829
}
30+
2931
</script>
3032

3133
<div class="prose">
32-
<h1 class="uppercase text-sl font-medium">😿 An Error Has Occurred, sorry 😭</h1>
34+
<h2 class="uppercase text-sl font-medium">😿 An Error Has Occurred, sorry 😭</h2>
3335
{#if toast}
3436
<div class="alert {toastClass}">{msg}</div>
3537
{/if}
3638
<h4 class="font-medium">This is what we know about it</h4>
39+
{#if currentPackage.hasOwnProperty("name")}
3740
<p>It has happened in package: {currentPackage.name}.</p>
41+
{/if}
3842
<pre class="code">
3943
<code>{error}</code>
4044
</pre>
@@ -54,22 +58,24 @@
5458
</li>
5559
<li>
5660
<a href="https://github.com/soapdog/patchfox/issues" target="_blank">
57-
Add an issue
61+
Create an issue report
5862
</a>
5963
to the Patchfox repository.
6064
</li>
6165
</ul>
66+
{#if currentPackage.hasOwnProperty("name")}
6267
<p>Do you want to see the source code for the current package (requires an internet connection)?</p>
6368
<ul>
6469
<li>
6570
<a href="https://github.com/soapdog/patchfox/blob/master/src/packages/{currentPackage.name}/{currentPackage.name}.js">
66-
view package <b>{currentPackage.name}</b> on github.
71+
view package <b>{currentPackage.name}</b> on GitHub.
6772
</a>
6873
</li>
6974
<li>
7075
<a href="https://git.sr.ht/~soapdog/patchfox/tree/master/src/packages/{currentPackage.name}/{currentPackage.name}.js">
71-
view package <b>{currentPackage.name}</b> on sourcehut.
76+
view package <b>{currentPackage.name}</b> on SourceHut.
7277
</a>
7378
</li>
7479
</ul>
80+
{/if}
7581
</div>

src/wm.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
let args = {}
1212
1313
patchfox.listen("package:changed", (event, data) => {
14-
console.log(event, data)
14+
console.log(`package changed to "${data.packageToOpen.name}.${data.view}"`)
1515
})
1616
1717
const goPackage = ({ pkg, view, data }) => {

0 commit comments

Comments
 (0)