From bbcc123e4e93bdf51aa3669e01186f402285f01a Mon Sep 17 00:00:00 2001 From: Mitchell McCaffrey Date: Tue, 9 Feb 2021 08:03:30 +1100 Subject: [PATCH 1/4] Updated drawing to console.log errors instead of Sentry log --- src/helpers/drawing.js | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/helpers/drawing.js b/src/helpers/drawing.js index 05ddb68..3deef0c 100644 --- a/src/helpers/drawing.js +++ b/src/helpers/drawing.js @@ -3,7 +3,6 @@ import polygonClipping from "polygon-clipping"; import * as Vector2 from "./vector2"; import { toDegrees, omit } from "./shared"; -import { logError } from "./logging"; const snappingThreshold = 1 / 5; export function getBrushPositionForTool( @@ -263,13 +262,7 @@ export function drawActionsToShapes(actions, actionIndex) { addPolygonDifferenceToShapes(shape, difference, cutShapes); addPolygonIntersectionToShapes(shape, intersection, cutShapes); } catch { - logError( - new Error( - `Unable to find segment for shapes ${JSON.stringify( - shape - )} and ${JSON.stringify(action)}` - ) - ); + console.error("Unable to cut shapes"); } } shapesById = cutShapes; @@ -357,7 +350,7 @@ export function mergeShapes(shapes) { } return merged; } catch { - logError(new Error(`Unable to merge shapes ${JSON.stringify(shapes)}`)); + console.error("Unable to merge shapes"); return shapes; } } From aad173830c142c71cb9dd1baf559a678f20cbbbf Mon Sep 17 00:00:00 2001 From: Mitchell McCaffrey Date: Tue, 9 Feb 2021 08:07:40 +1100 Subject: [PATCH 2/4] Added check for name in unhandled error --- src/contexts/DatabaseContext.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/contexts/DatabaseContext.js b/src/contexts/DatabaseContext.js index 323b49a..d0a18be 100644 --- a/src/contexts/DatabaseContext.js +++ b/src/contexts/DatabaseContext.js @@ -40,7 +40,7 @@ export function DatabaseProvider({ children }) { }; function handleDatabaseError(event) { - if (event.reason.name === "QuotaExceededError") { + if (event.reason?.name === "QuotaExceededError") { event.preventDefault(); setDatabaseError({ name: event.reason.name, From 3b30cc388243244205f11a6f8eed115e6298ea64 Mon Sep 17 00:00:00 2001 From: Mitchell McCaffrey Date: Tue, 9 Feb 2021 08:11:24 +1100 Subject: [PATCH 3/4] Update index.js --- src/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/index.js b/src/index.js index eb5885f..28ae083 100644 --- a/src/index.js +++ b/src/index.js @@ -20,12 +20,15 @@ if (process.env.REACT_APP_LOGGING === "true") { // Ignore quota error // Ignore XDR encoding failure bug in Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=1678243 // Ignore LastPass extension text error + // Ignore WebRTC error TODO: Remove after 1.8 + // Ignore chrome extension error ignoreErrors: [ "ResizeObserver loop limit exceeded", "QuotaExceededError", "XDR encoding failure", "Assertion failed: Input argument is not an HTMLInputElement", "No WebRTC support", + "Extension context invalidated", ], }); } From c10a818d6512f4675c646384fb65146cde2d03e4 Mon Sep 17 00:00:00 2001 From: Mitchell McCaffrey Date: Sun, 14 Feb 2021 08:50:27 +1100 Subject: [PATCH 4/4] Fix crash with resized images over the canvas size limitation --- src/modals/SelectMapModal.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/modals/SelectMapModal.js b/src/modals/SelectMapModal.js index 2236bc5..c31465c 100644 --- a/src/modals/SelectMapModal.js +++ b/src/modals/SelectMapModal.js @@ -183,14 +183,16 @@ function SelectMapModal({ file.type, resolution.quality ); - const resizedBuffer = await blobToBuffer(resized.blob); - resolutions[resolution.id] = { - file: resizedBuffer, - width: resized.width, - height: resized.height, - type: "file", - id: resolution.id, - }; + if (resized.blob) { + const resizedBuffer = await blobToBuffer(resized.blob); + resolutions[resolution.id] = { + file: resizedBuffer, + width: resized.width, + height: resized.height, + type: "file", + id: resolution.id, + }; + } } }