Autotest error messages

This commit is contained in:
Romein van Buren 2022-07-13 13:51:10 +02:00
parent a457e27307
commit f8676c4c13
Signed by: romein
GPG Key ID: 0EFF8478ADDF6C49
2 changed files with 9 additions and 3 deletions

View File

@ -353,7 +353,7 @@ module.exports = {
return 'autotest must be an array';
}
else if (newValues.autotest) {
for (const [ iEndpoint, endpoint ] of newValues.autotest.entries()) {
for (const endpoint of newValues.autotest) {
if (!url.test(endpoint.uri)) {
return 'not a valid url';
}
@ -365,10 +365,10 @@ module.exports = {
const foundHeaders = [];
for (const header of endpoint.headers) {
if (foundHeaders.includes(header.name)) {
return 'found duplicate headers in endpoint #' + iEndpoint;
return 'found duplicate headers in endpoint ' + endpoint.uri;
}
else if (!header.name || !header.name.trim || !header.name.trim()) {
return 'empty header name in endpoint #' + iEndpoint;
return 'empty header name in endpoint ' + endpoint.uri;
}
else {
foundHeaders.push(header.name);

View File

@ -4,12 +4,14 @@ import { createEventDispatcher } from 'svelte';
import Toggle from 'components/webdesq/toggle.svelte';
import { operatorNames } from '../../lib/operators';
import { realValueNames } from '../../lib/realvalues';
import { fade } from 'svelte/transition';
export let value = [];
export let specs = {};
export let readonly = true;
export let language = 'en';
export let translate = s => s;
export let error = false;
const dispatch = createEventDispatcher();
const defaultEndpoint = {
@ -220,6 +222,10 @@ function removeEndpoint(i) {
</button>
</div>
{#if error}
<span transition:fade class="error">{error}</span>
{/if}
<style>
div:not(:last-child) {
margin-bottom: 10px;