diff --git a/packages/insomnia/src/ui/components/.client/codemirror/extensions/nunjucks-tags.ts b/packages/insomnia/src/ui/components/.client/codemirror/extensions/nunjucks-tags.ts index 0b273972c5..67615866f7 100644 --- a/packages/insomnia/src/ui/components/.client/codemirror/extensions/nunjucks-tags.ts +++ b/packages/insomnia/src/ui/components/.client/codemirror/extensions/nunjucks-tags.ts @@ -213,10 +213,14 @@ async function _highlightNunjucksTags( // TODO: Actually only use dropEffect for this logic. For some reason // changing it doesn't seem to take affect in Chromium 56 (maybe bug?) if (droppedInSameEditor) { - // TODO: unsound non-null assertion + const pos = mark.find(); - const { from, to } = mark.find()!; - this.replaceRange('', from, to, '+dnd'); + if (pos) { + const { from, to } = pos; + this.replaceRange('', from, to, '+dnd'); + } else { + console.warn('Tried to remove mark that did not exist', mark); + } } // Remove listeners we added diff --git a/packages/insomnia/src/ui/components/error-boundary.tsx b/packages/insomnia/src/ui/components/error-boundary.tsx index e35dad7a10..c92fd0de1f 100644 --- a/packages/insomnia/src/ui/components/error-boundary.tsx +++ b/packages/insomnia/src/ui/components/error-boundary.tsx @@ -30,6 +30,9 @@ class SingleErrorBoundary extends PureComponent { const { children } = this.props; const firstChild = Array.isArray(children) && children.length === 1 ? children[0] : children; this.setState({ error, info }); + // The fallback below only shows error.message; log the full stack and component + // stack so a crash can actually be diagnosed from the console. + console.error('ErrorBoundary caught an error:', error, info.componentStack); let componentName = 'component'; try {