Improve error messages when Interface server is invalid
This commit is contained in:
parent
0cf1cf3aa0
commit
2dbb24ea04
@ -35,9 +35,15 @@ function _ankiSetError(error) {
|
|||||||
const node = document.querySelector('#anki-error');
|
const node = document.querySelector('#anki-error');
|
||||||
if (!node) { return; }
|
if (!node) { return; }
|
||||||
if (error) {
|
if (error) {
|
||||||
|
const errorString = `${error}`;
|
||||||
node.hidden = false;
|
node.hidden = false;
|
||||||
node.textContent = `${error}`;
|
node.textContent = errorString;
|
||||||
_ankiSetErrorData(node, error);
|
_ankiSetErrorData(node, error);
|
||||||
|
|
||||||
|
const node2 = document.querySelector('#anki-invalid-response-error');
|
||||||
|
if (node2 !== null) {
|
||||||
|
node2.hidden = (errorString.indexOf('Invalid response') < 0);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
node.hidden = true;
|
node.hidden = true;
|
||||||
node.textContent = '';
|
node.textContent = '';
|
||||||
|
@ -760,6 +760,13 @@
|
|||||||
|
|
||||||
<div class="alert alert-danger" id="anki-error" hidden></div>
|
<div class="alert alert-danger" id="anki-error" hidden></div>
|
||||||
|
|
||||||
|
<div class="alert alert-danger" id="anki-invalid-response-error" hidden>
|
||||||
|
Attempting to connect to Anki can sometimes return an error message which includes "Invalid response",
|
||||||
|
which may indicate that the value of the <strong>Interface server</strong> option is incorrect.
|
||||||
|
The <strong>Show advanced options</strong> checkbox under General Options must be ticked ticked to show this option.
|
||||||
|
Resetting it to the default value may fix issues that are occurring.
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="card-tags">Card tags <span class="label-light">(comma or space separated)</span></label>
|
<label for="card-tags">Card tags <span class="label-light">(comma or space separated)</span></label>
|
||||||
<input type="text" id="card-tags" class="form-control">
|
<input type="text" id="card-tags" class="form-control">
|
||||||
@ -771,7 +778,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group options-advanced">
|
<div class="form-group options-advanced">
|
||||||
<label for="interface-server">Interface server</label>
|
<label for="interface-server">Interface server <span class="label-light">(Default: http://127.0.0.1:8765)</span></label>
|
||||||
<input type="text" id="interface-server" class="form-control">
|
<input type="text" id="interface-server" class="form-control">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user