Skip to content

Commit

Permalink
resolve
Browse files Browse the repository at this point in the history
  • Loading branch information
ThatDeparted2061 committed Feb 3, 2025
1 parent f88bdf6 commit 4962f5d
Showing 1 changed file with 16 additions and 17 deletions.
33 changes: 16 additions & 17 deletions src/simulator/src/Verilog2CV.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ import { showProperties } from './ux';
import { useSimulatorMobileStore } from '#/store/simulatorMobileStore';
import { toRefs } from 'vue';

import {GlobalScope} from './types/verilog.types';
import {CircuitElement} from './types/verilog.types';
import {YosysJSON} from './types/verilog.types';
import {SimulatorMobileStore} from './types/verilog.types';
import {Node} from './types/verilog.types';
import { GlobalScope } from './types/verilog.types';
import { CircuitElement } from './types/verilog.types';
import { YosysJSON } from './types/verilog.types';
import { SimulatorMobileStore } from './types/verilog.types';
import { Node } from './types/verilog.types';

declare var globalScope: GlobalScope;
declare var embed: boolean;
Expand Down Expand Up @@ -126,8 +126,8 @@ function disableVerilogMode(): void {
}

function setElementDisplay(selector: string, display: string): void {
const element = selector.startsWith('.') || selector.startsWith('#')
? document.querySelector(selector)
const element = selector.startsWith('.') || selector.startsWith('#')
? document.querySelector(selector)
: document.getElementById(selector);
if (element) (element as HTMLElement).style.display = display;
}
Expand Down Expand Up @@ -280,16 +280,15 @@ export default function generateVerilogCircuit(
const verilogOutput = document.getElementById('verilogOutput');
if (verilogOutput) verilogOutput.innerHTML = '';
})
.catch((error: Response) => {
if (error.status === 500) {
showError('Could not connect to Yosys');
} else {
showError('There is some issue with the code');
error.json().then((errorMessage: { message: string }) => {
const verilogOutput = document.getElementById('verilogOutput');
if (verilogOutput) verilogOutput.innerHTML = errorMessage.message;
});
}
.catch(async (error: Response) => {
const errorMessage = error.status === 500
? 'Could not connect to Yosys server. Please try again later.'
: await error.json().then((e: { message: string }) => e.message)
.catch(() => 'An unexpected error occurred');

showError(errorMessage);
const verilogOutput = document.getElementById('verilogOutput');
if (verilogOutput) verilogOutput.innerHTML = errorMessage;
});
}

Expand Down

0 comments on commit 4962f5d

Please sign in to comment.