diff --git a/jetlinks-components/notify-component/notify-email/src/main/java/org/jetlinks/community/notify/email/embedded/DefaultEmailNotifier.java b/jetlinks-components/notify-component/notify-email/src/main/java/org/jetlinks/community/notify/email/embedded/DefaultEmailNotifier.java index f264e6422..bf256d417 100755 --- a/jetlinks-components/notify-component/notify-email/src/main/java/org/jetlinks/community/notify/email/embedded/DefaultEmailNotifier.java +++ b/jetlinks-components/notify-component/notify-email/src/main/java/org/jetlinks/community/notify/email/embedded/DefaultEmailNotifier.java @@ -154,7 +154,14 @@ protected Mono doSend(ParsedEmailTemplate template) { return Flux .fromIterable(template.getAttachments().entrySet()) - .flatMap(entry -> Mono.zip(Mono.just(entry.getKey()), convertResource(entry.getValue()))) + .flatMap(entry -> Mono + .zip(Mono.just(entry.getKey()), convertResource(entry.getValue())) + .onErrorResume(err -> Mono + .error(() -> new BusinessException.NoStackTrace("error.load_attachment_failed", + 500, + entry.getKey(), + err.getMessage()))) + ) .flatMap(tp2 -> Mono .fromCallable(() -> { //添加附件 diff --git a/jetlinks-components/notify-component/notify-email/src/main/resources/i18n/messages_en.properties b/jetlinks-components/notify-component/notify-email/src/main/resources/i18n/messages_en.properties new file mode 100644 index 000000000..b6c290431 --- /dev/null +++ b/jetlinks-components/notify-component/notify-email/src/main/resources/i18n/messages_en.properties @@ -0,0 +1 @@ +error.load_attachment_failed=load attachment [{0}] failed:{1} \ No newline at end of file diff --git a/jetlinks-components/notify-component/notify-email/src/main/resources/i18n/messages_zh.properties b/jetlinks-components/notify-component/notify-email/src/main/resources/i18n/messages_zh.properties new file mode 100644 index 000000000..ab37a64ce --- /dev/null +++ b/jetlinks-components/notify-component/notify-email/src/main/resources/i18n/messages_zh.properties @@ -0,0 +1 @@ +error.load_attachment_failed=\u52A0\u8F7D\u9644\u4EF6[{0}]\u5931\u8D25\uFF1A{1} \ No newline at end of file