Skip to content

Commit fc936b9

Browse files
authored
Merge pull request #273 from rritik772/fix/no-error-location
Fix parser silently failing when there is no error location
2 parents b03b785 + d65276b commit fc936b9

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/components/EditorHeader/Modal/Modal.jsx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -148,17 +148,16 @@ export default function Modal({
148148
database: database === DB.GENERIC ? importDb : database,
149149
});
150150
} catch (err) {
151+
let message = err.message;
152+
if (err.location) {
153+
message = err.name + " [Ln " + err.location.start.line + ", Col " + err.location.start.column + "]: " + err.message;
154+
}
155+
151156
setError({
152157
type: STATUS.ERROR,
153-
message:
154-
err.name +
155-
" [Ln " +
156-
err.location.start.line +
157-
", Col " +
158-
err.location.start.column +
159-
"]: " +
160-
err.message,
158+
message
161159
});
160+
162161
return;
163162
}
164163

0 commit comments

Comments
 (0)