From 1cf332b15cd6116bac0ed70a22d57fdf2ce03034 Mon Sep 17 00:00:00 2001 From: Sean Engelhardt Date: Mon, 16 Sep 2019 11:46:29 +0200 Subject: [PATCH] Catch and show line numbering errors Makes line number and motion detail more robust --- .../motions/motion-repository.service.ts | 12 +++- .../motion-detail.component.html | 66 ++++++++++--------- 2 files changed, 46 insertions(+), 32 deletions(-) diff --git a/client/src/app/core/repositories/motions/motion-repository.service.ts b/client/src/app/core/repositories/motions/motion-repository.service.ts index 9ea15f1f8..fcf656c4d 100644 --- a/client/src/app/core/repositories/motions/motion-repository.service.ts +++ b/client/src/app/core/repositories/motions/motion-repository.service.ts @@ -245,12 +245,20 @@ export class MotionRepositoryService extends BaseIsAgendaItemAndListOfSpeakersCo foreignViewModel: ViewMotion, afterSetRelation: (motion: ViewMotion, foreignViewModel: ViewMotion | null) => { if (foreignViewModel) { - motion.diffLines = this.getAmendmentParagraphs(motion, this.motionLineLength, false); + try { + motion.diffLines = this.getAmendmentParagraphs(motion, this.motionLineLength, false); + } catch (e) { + console.warn('Error with motion or amendment ', motion); + } } }, afterDependencyChange: (motion: ViewMotion, parent: ViewMotion) => { if (motion.parent) { - motion.diffLines = this.getAmendmentParagraphs(motion, this.motionLineLength, false); + try { + motion.diffLines = this.getAmendmentParagraphs(motion, this.motionLineLength, false); + } catch (e) { + console.warn('Error with motion or amendment: ', motion); + } } } }); diff --git a/client/src/app/site/motions/modules/motion-detail/components/motion-detail/motion-detail.component.html b/client/src/app/site/motions/modules/motion-detail/components/motion-detail/motion-detail.component.html index a47669a8e..39f5bca3a 100644 --- a/client/src/app/site/motions/modules/motion-detail/components/motion-detail/motion-detail.component.html +++ b/client/src/app/site/motions/modules/motion-detail/components/motion-detail/motion-detail.component.html @@ -464,10 +464,7 @@
-
+
@@ -858,34 +855,43 @@
-
- No changes at the text. -
-
- -

+
+ +
+ No changes at the text. +
+
- {{ 'Line' | translate }} {{ paragraph.diffLineFrom }}: -

-

- {{ 'Line' | translate }} {{ paragraph.diffLineFrom }} - {{ paragraph.diffLineTo - 1 }}: -

+ +

+ {{ 'Line' | translate }} {{ paragraph.diffLineFrom }}: +

+

+ {{ 'Line' | translate }} {{ paragraph.diffLineFrom }} - {{ paragraph.diffLineTo - 1 }}: +

-
-
-
+
+
+
+
+
+
+ + There is an error with this amendment. Please manually edit it. +