Skip to content

Commit 92ee8d9

Browse files
committed
#386 catch a possible exception from userService
Bump up to 5.0.1 snapshot
1 parent d5ae671 commit 92ee8d9

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* rights and limitations under the License.
1212
*/
1313
buildscript {
14-
version "5.0-SNAPSHOT"
14+
version "5.0.1-SNAPSHOT"
1515
group "au.org.ala"
1616
}
1717

grails-app/services/au/org/ala/alerts/NotificationService.groovy

+9-5
Original file line numberDiff line numberDiff line change
@@ -636,11 +636,15 @@ class NotificationService {
636636
emailService.sendGroupNotification(qr, frequency, recipients)
637637
}
638638

639-
User currentUser = userService.getUser()
640-
if (currentUser && grailsApplication.config.testMode) {
641-
def me =
642-
[email: currentUser.email, userUnsubToken: currentUser.unsubscribeToken, notificationUnsubToken: '']
643-
emailService.sendGroupNotification(qr, frequency, [me])
639+
if (grailsApplication.config.testMode) {
640+
try {
641+
User currentUser = userService.getUser()
642+
def me =
643+
[email: currentUser.email, userUnsubToken: currentUser.unsubscribeToken, notificationUnsubToken: '']
644+
emailService.sendGroupNotification(qr, frequency, [me])
645+
} catch (Exception e) {
646+
log.error("TestMode is on, but failed to sending alerts to the current user: " + e.getMessage())
647+
}
644648
}
645649
}
646650
logs << info

0 commit comments

Comments
 (0)