added try catch block on streamNodeData

This commit is contained in:
anovazzi1 2023-06-13 18:45:42 -03:00
commit 86751e0daf

View file

@ -60,7 +60,7 @@ export default function BuildTrigger({
let finished = false; let finished = false;
apiUrl = `/build/stream/${flowId}`; apiUrl = `/build/stream/${flowId}`;
const eventSource = new EventSource(apiUrl); const eventSource = new EventSource(apiUrl);
try{
eventSource.onmessage = (event) => { eventSource.onmessage = (event) => {
// If the event is parseable, return // If the event is parseable, return
if (!event.data) { if (!event.data) {
@ -90,6 +90,12 @@ export default function BuildTrigger({
// Step 4: Return true if all nodes are valid, false otherwise // Step 4: Return true if all nodes are valid, false otherwise
return validationResults.every((result) => result); return validationResults.every((result) => result);
} }
catch(e){
console.log(e)
eventSource.close();
return false;
}
}
function processStreamResult(parsedData) { function processStreamResult(parsedData) {
// Process each chunk of data here // Process each chunk of data here