[fix] calculator: move math.parse inside try-catch (#6278) (#6280)

* [fix] calculator: move math.parse inside try-catch (#6278)

* build static

---------

Co-authored-by: Ivan Gabaldon <igabaldon@inetol.net>
This commit is contained in:
Jayant Sharma
2026-06-18 21:06:47 +05:30
committed by GitHub
parent bd73cc09ea
commit b5ef7ec8f3
5 changed files with 7 additions and 7 deletions
+1 -1
View File
@@ -77,9 +77,9 @@ export default class Calculator extends Plugin {
protected async run(): Promise<string | undefined> {
const searchInput = getElement<HTMLInputElement>("q");
const node = Calculator.math.parse(searchInput.value);
try {
const node = Calculator.math.parse(searchInput.value);
return `${node.toString()} = ${node.evaluate()}`;
} catch {
// not a compatible math expression