Changes to support some new error formats.

main
Zed A. Shaw 2 years ago
parent 8d7ae450e1
commit 8af16cafad
  1. 8
      admin/bando/Bandolier.svelte
  2. 17
      admin/pages/Errors.svelte
  3. 10
      static/djenterator/command.js

@ -109,7 +109,13 @@
</a>
<ul>
{#each errors as error, i}
<li>{ error.location.file}</li>
{#if error.location}
<li>{ error.location.file}</li>
{:else if error.filename}
<li>{ error.filename }</li>
{:else}
<li>Weird error, check console.</li>
{/if}
{/each}
</ul>
</bando>

@ -66,7 +66,7 @@
</top>
<items>
{#each errors as error}
<a on:click={ () => error_selected = error }>{ error.location.file}</a>
<a on:click={ () => error_selected = error }>{ error.location ? error.location.file : error.filename}</a>
{:else}
<h3>No Errors</h3>
<span>You currently have no errors that are shown. Try refreshing.</span>
@ -75,7 +75,8 @@
</sidebar>
<display>
{#if error_selected}
{#if error_selected}
{#if error_selected.location}
<h1>{error_selected.location.file} <Icon name="alert-circle" size="36" /></h1>
<h3>{ error_selected.text }</h3>
<pre>
@ -96,7 +97,17 @@
</code>
</pre>
{/each}
{/if}
{:else if error_selected.filename}
<h1>{error_selected.filename} <Icon name="alert-circle" size="36" /></h1>
<h3>{ error_selected.message }</h3>
<pre><code>{error_selected.code}</code></pre>
<h1>Stack</h1>
<pre><code>{ error_selected.stack }</code></pre>
{:else}
<p>Unknown error I've never seen before. Look in console and in `debug/` for error output files.</p>
{/if}
{/if}
</display>
</content>
{/await}

@ -32,6 +32,16 @@ const check = (test, fail_message) => {
}
}
/*
+ FOOTGUN: commander tries to be "fancy" and if you don't have
an `arguments` setting for positional arguments then you
have to change this to `(opts)` instead of `(arg, opts)`.
The reason is if your command doesn't have an argument, then
commander will call your main with only opts, and if it does
then it calls your main with arg, and opts. If you get weird
errors and `opts` looks like a `Command` object then this is
what happened.
*/
export const main = async (arg, opts) => {
// if they give an numeric option this is how you can convert it
// yes, this is annoying and commander should handle it but oh well

Loading…
Cancel
Save