Browse Source

Catch and log file message submit errors

Danilo Bargen 7 years ago
parent
commit
6c1d8cf41f
2 changed files with 7 additions and 3 deletions
  1. 6 2
      src/directives/compose_area.ts
  2. 1 1
      src/partials/messenger.ts

+ 6 - 2
src/directives/compose_area.ts

@@ -374,7 +374,9 @@ export default [
 
                             fileMessages.push(fileMessageData);
                         });
-                        scope.submit('file', fileMessages);
+                        scope
+                            .submit('file', fileMessages)
+                            .catch((msg) => $log.error('Could not send file:', msg));
                         scope.onUploading(false);
 
                     }).catch((ev: ErrorEvent) => {
@@ -437,7 +439,9 @@ export default [
                                 size: blob.size,
                                 data: buffer,
                             };
-                            scope.submit('file', [fileMessageData]);
+                            scope
+                                .submit('file', [fileMessageData])
+                                .catch((msg) => $log.error('Could not send file:', msg));
                         };
                         reader.readAsArrayBuffer(blob);
 

+ 1 - 1
src/partials/messenger.ts

@@ -460,7 +460,7 @@ class ConversationController {
                     if (success) {
                         resolve();
                     } else {
-                        reject();
+                        reject('Message sending unsuccessful');
                     }
                 }
             };