Skip to content

Free, simple, and intuitive online database diagram editor and SQL generator.

if no error location is avaliable

Ritik Ranjand65276badc8e
diff --git a/src/components/EditorHeader/Modal/Modal.jsx b/src/components/EditorHeader/Modal/Modal.jsx
index 009b6892..c38a7d5e 100644
--- a/src/components/EditorHeader/Modal/Modal.jsx
+++ b/src/components/EditorHeader/Modal/Modal.jsx
@@ -148,17 +148,16 @@ export default function Modal({
database: database === DB.GENERIC ? importDb : database,
});
} catch (err) {
+ let message = err.message;
+ if (err.location) {
+ message = err.name + " [Ln " + err.location.start.line + ", Col " + err.location.start.column + "]: " + err.message;
+ }
+
setError({
type: STATUS.ERROR,
- message:
- err.name +
- " [Ln " +
- err.location.start.line +
- ", Col " +
- err.location.start.column +
- "]: " +
- err.message,
+ message
});
+
return;
}