From 97ab5a19676d368eb867fcf4b074c2b7cd1fb21c Mon Sep 17 00:00:00 2001 From: Tanner Barlow Date: Fri, 8 Mar 2019 14:08:09 -0800 Subject: [PATCH] Ignore error from react drag n drop (#648) --- .../components/common/errorHandler/errorHandler.tsx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/react/components/common/errorHandler/errorHandler.tsx b/src/react/components/common/errorHandler/errorHandler.tsx index 15a5696b01..7bfc254a9f 100644 --- a/src/react/components/common/errorHandler/errorHandler.tsx +++ b/src/react/components/common/errorHandler/errorHandler.tsx @@ -77,6 +77,14 @@ export class ErrorHandler extends React.Component { * @param error The error to handle */ private handleError(error: string | Error | AppError) { + // This is a special case where we don't need to throw an + // exception. The error is thrown from within a few layers + // of components, so we don't have access to ReactDnD (drag and drop) + // directly. The action is performed correctly, so we + // don't need to display the error here + if (this.isReactDnDError(error)) { + return; + } let appError: IAppError = null; // Promise rejection with reason if (typeof (error) === "string") { @@ -137,4 +145,8 @@ export class ErrorHandler extends React.Component { title: localizedError.title, }; } + + private isReactDnDError(e) { + return e.name === "Invariant Violation" && e.message === "Expected to find a valid target."; + } }