mirror of
https://github.com/msoedov/agentic_security.git
synced 2026-08-09 11:16:03 +02:00
Merge pull request #187 from nemanjaASE/issue-173-no-error-handling
Add error handling in main.js (verifyIntegration)
This commit is contained in:
@@ -215,33 +215,39 @@ var app = new Vue({
|
|||||||
spec: this.modelSpec,
|
spec: this.modelSpec,
|
||||||
};
|
};
|
||||||
let startTime = performance.now(); // Capture start time
|
let startTime = performance.now(); // Capture start time
|
||||||
const response = await fetch(`${SELF_URL}/verify`, {
|
|
||||||
method: 'POST',
|
try {
|
||||||
headers: {
|
const response = await fetch(`${SELF_URL}/verify`, {
|
||||||
'Content-Type': 'application/json',
|
method: 'POST',
|
||||||
},
|
headers: {
|
||||||
body: JSON.stringify(payload),
|
'Content-Type': 'application/json',
|
||||||
});
|
},
|
||||||
console.log(response);
|
body: JSON.stringify(payload),
|
||||||
let r = await response.json();
|
});
|
||||||
let endTime = performance.now(); // Capture end time
|
|
||||||
let latency = endTime - startTime; // Calculate latency in milliseconds
|
let r = await response.json();
|
||||||
latency = latency.toFixed(3) / 1000; // Round to 2 decimal places
|
|
||||||
this.latency = latency;
|
|
||||||
if (!response.ok) {
|
|
||||||
this.updateStatusDot(false);
|
|
||||||
this.errorMsg = 'Integration verification failed:' + JSON.stringify(r);
|
|
||||||
this.showToast('Integration verification failed', 'error');
|
|
||||||
} else {
|
|
||||||
this.errorMsg = '';
|
|
||||||
this.updateStatusDot(true);
|
|
||||||
this.okMsg = 'Integration verified';
|
|
||||||
this.showToast('Integration verified successfully', 'success');
|
|
||||||
this.integrationVerified = true;
|
|
||||||
// console.log('Integration verified', this.integrationVerified);
|
|
||||||
// this.$forceUpdate();
|
|
||||||
|
|
||||||
|
let endTime = performance.now(); // Capture end time
|
||||||
|
let latency = ((endTime - startTime) / 1000).toFixed(3); // Calculate latency in milliseconds
|
||||||
|
this.latency = latency;
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
this.updateStatusDot(false);
|
||||||
|
this.errorMsg = 'Integration verification failed:' + JSON.stringify(r);
|
||||||
|
this.showToast('Integration verification failed', 'error');
|
||||||
|
} else {
|
||||||
|
this.errorMsg = '';
|
||||||
|
this.updateStatusDot(true);
|
||||||
|
this.okMsg = 'Integration verified';
|
||||||
|
this.showToast('Integration verified successfully', 'success');
|
||||||
|
this.integrationVerified = true;
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
this.updateStatusDot(true);
|
||||||
|
this.errorMsg = 'Server unreachable';
|
||||||
|
this.showToast('Network error', 'error');
|
||||||
}
|
}
|
||||||
|
|
||||||
this.saveStateToLocalStorage();
|
this.saveStateToLocalStorage();
|
||||||
},
|
},
|
||||||
loadConfigs: async function () {
|
loadConfigs: async function () {
|
||||||
|
|||||||
Reference in New Issue
Block a user