Skip to content
This repository has been archived by the owner on Dec 27, 2022. It is now read-only.

Commit

Permalink
Merge pull request #814 from samuelmaddock/swarm-debugger-error
Browse files Browse the repository at this point in the history
Render swarm debugger error in view
  • Loading branch information
pfrazee committed Jan 12, 2018
2 parents 7c56702 + 13d26f2 commit 55587e3
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion app/builtin-pages/views/swarm-debugger.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@ var peers = []

setup()
async function setup () {
archiveKey = await parseURL()
try {
archiveKey = await parseURL()
} catch (e) {
renderUsage(e.message)
return
}

render()
updatePeers()

Expand Down Expand Up @@ -79,6 +85,15 @@ function updatePeers () {
`)
}

function renderUsage (err) {
yo.update(document.querySelector('main'), yo`
<main>
<h1>${err}</h1>
<h2>A valid dat URL is required in the URL path.</h2>
</main>
`)
}

function onLog ({args}) {
document.querySelector('.log').appendChild(yo`<div>${args.join('')}</div>`)
}

0 comments on commit 55587e3

Please sign in to comment.