LP#1855780: improve reporting of event test errors
authorGalen Charlton <gmc@equinoxOLI.org>
Tue, 9 Nov 2021 15:41:58 +0000 (10:41 -0500)
committerJane Sandberg <sandbergja@gmail.com>
Wed, 17 Nov 2021 19:55:12 +0000 (11:55 -0800)
- make error title/caption strings available to i18n
- catch and report on exceptions, not just ILS events

Signed-off-by: Galen Charlton <gmc@equinoxOLI.org>
Signed-off-by: Jane Sandberg <sandbergja@gmail.com>
Open-ILS/src/eg2/src/app/staff/admin/local/triggers/trigger-edit.component.html
Open-ILS/src/eg2/src/app/staff/admin/local/triggers/trigger-edit.component.ts

index 29f54a7..6aaa890 100644 (file)
@@ -95,3 +95,8 @@
 <eg-string #cloneFailedString i18n-text text="Clone of entry failed or was not allowed">
 </eg-string>
 <eg-string #cloneSuccessString i18n-text text="Clone of entry succeeded"></eg-string>
+<eg-string #errorDuringTestString i18n-text text="Error when testing event definition:"></eg-string>
+<ng-template #errorDuringTestStringTmpl let-ilsevent="ilsevent" let-textcode="textcode" i18n>
+  Error when testing event defintion ({{ilsevent}}: {{textcode}}):
+</ng-template>
+<eg-string #eventDuringTestString [template]="errorDuringTestStringTmpl"></eg-string>
index dcd34e0..9b665b6 100644 (file)
@@ -46,6 +46,8 @@ export class EditEventDefinitionComponent implements OnInit {
     @ViewChild('deleteSuccessString') deleteSuccessString: StringComponent;
     @ViewChild('createSuccessString') createSuccessString: StringComponent;
     @ViewChild('createErrString') createErrString: StringComponent;
+    @ViewChild('eventDuringTestString') eventDuringTestString: StringComponent;
+    @ViewChild('errorDuringTestString') errorDuringTestString: StringComponent;
 
     constructor(
         private router: Router,
@@ -190,11 +192,16 @@ export class EditEventDefinitionComponent implements OnInit {
         ).subscribe(res => {
             this.testDone = true;
             if (res.ilsevent) {
-                this.testErr1 = 'Event:  ' + res.ilsevent + ':  ' + res.textcode + ' ->';
+                this.eventDuringTestString.current({ ilsevent: res.ilsevent, textcode : res.textcode})
+                    .then(str => this.testErr1 = str);
                 this.testErr2 = res.desc;
             } else {
                 this.testResult = res.template_output().data();
             }
+        }, err => {
+            this.testDone = true;
+            this.errorDuringTestString.current().then(str => this.testErr1 = str);
+            this.testErr2 = err;
         });
     }