@@ -50,11 +50,13 @@ internal open class UserManager(
50
50
Logging .log(LogLevel .DEBUG , " setAlias(label: $label , id: $id )" )
51
51
52
52
if (label.isEmpty()) {
53
- throw Exception (" Cannot add empty alias" )
53
+ Logging .log(LogLevel .ERROR , " Cannot add empty alias" )
54
+ return
54
55
}
55
56
56
57
if (label == IdentityConstants .ONESIGNAL_ID ) {
57
- throw Exception (" Cannot add '${IdentityConstants .ONESIGNAL_ID } ' alias" )
58
+ Logging .log(LogLevel .ERROR , " Cannot add '${IdentityConstants .ONESIGNAL_ID } ' alias" )
59
+ return
58
60
}
59
61
60
62
_identityModel [label] = id
@@ -65,11 +67,13 @@ internal open class UserManager(
65
67
66
68
aliases.forEach {
67
69
if (it.key.isEmpty()) {
68
- throw Exception (" Cannot add empty alias" )
70
+ Logging .log(LogLevel .ERROR , " Cannot add empty alias" )
71
+ return
69
72
}
70
73
71
74
if (it.key == IdentityConstants .ONESIGNAL_ID ) {
72
- throw Exception (" Cannot add '${IdentityConstants .ONESIGNAL_ID } ' alias" )
75
+ Logging .log(LogLevel .ERROR , " Cannot add '${IdentityConstants .ONESIGNAL_ID } ' alias" )
76
+ return
73
77
}
74
78
}
75
79
@@ -82,11 +86,13 @@ internal open class UserManager(
82
86
Logging .log(LogLevel .DEBUG , " removeAlias(label: $label )" )
83
87
84
88
if (label.isEmpty()) {
85
- throw Exception (" Cannot remove empty alias" )
89
+ Logging .log(LogLevel .ERROR , " Cannot remove empty alias" )
90
+ return
86
91
}
87
92
88
93
if (label == IdentityConstants .ONESIGNAL_ID ) {
89
- throw Exception (" Cannot remove '${IdentityConstants .ONESIGNAL_ID } ' alias" )
94
+ Logging .log(LogLevel .ERROR , " Cannot remove '${IdentityConstants .ONESIGNAL_ID } ' alias" )
95
+ return
90
96
}
91
97
92
98
_identityModel .remove(label)
@@ -97,11 +103,13 @@ internal open class UserManager(
97
103
98
104
labels.forEach {
99
105
if (it.isEmpty()) {
100
- throw Exception (" Cannot remove empty alias" )
106
+ Logging .log(LogLevel .ERROR , " Cannot remove empty alias" )
107
+ return
101
108
}
102
109
103
110
if (it == IdentityConstants .ONESIGNAL_ID ) {
104
- throw Exception (" Cannot remove '${IdentityConstants .ONESIGNAL_ID } ' alias" )
111
+ Logging .log(LogLevel .ERROR , " Cannot remove '${IdentityConstants .ONESIGNAL_ID } ' alias" )
112
+ return
105
113
}
106
114
}
107
115
@@ -114,7 +122,8 @@ internal open class UserManager(
114
122
Logging .log(LogLevel .DEBUG , " addEmail(email: $email )" )
115
123
116
124
if (! OneSignalUtils .isValidEmail(email)) {
117
- throw Exception (" Cannot add invalid email address as subscription: $email " )
125
+ Logging .log(LogLevel .ERROR , " Cannot add invalid email address as subscription: $email " )
126
+ return
118
127
}
119
128
120
129
_subscriptionManager .addEmailSubscription(email)
@@ -124,7 +133,8 @@ internal open class UserManager(
124
133
Logging .log(LogLevel .DEBUG , " removeEmail(email: $email )" )
125
134
126
135
if (! OneSignalUtils .isValidEmail(email)) {
127
- throw Exception (" Cannot remove invalid email address as subscription: $email " )
136
+ Logging .log(LogLevel .ERROR , " Cannot remove invalid email address as subscription: $email " )
137
+ return
128
138
}
129
139
130
140
_subscriptionManager .removeEmailSubscription(email)
@@ -134,7 +144,8 @@ internal open class UserManager(
134
144
Logging .log(LogLevel .DEBUG , " addSms(sms: $sms )" )
135
145
136
146
if (! OneSignalUtils .isValidPhoneNumber(sms)) {
137
- throw Exception (" Cannot add invalid sms number as subscription: $sms " )
147
+ Logging .log(LogLevel .ERROR , " Cannot add invalid sms number as subscription: $sms " )
148
+ return
138
149
}
139
150
140
151
_subscriptionManager .addSmsSubscription(sms)
@@ -144,7 +155,8 @@ internal open class UserManager(
144
155
Logging .log(LogLevel .DEBUG , " removeSms(sms: $sms )" )
145
156
146
157
if (! OneSignalUtils .isValidPhoneNumber(sms)) {
147
- throw Exception (" Cannot remove invalid sms number as subscription: $sms " )
158
+ Logging .log(LogLevel .ERROR , " Cannot remove invalid sms number as subscription: $sms " )
159
+ return
148
160
}
149
161
150
162
_subscriptionManager .removeSmsSubscription(sms)
@@ -154,7 +166,8 @@ internal open class UserManager(
154
166
Logging .log(LogLevel .DEBUG , " setTag(key: $key , value: $value )" )
155
167
156
168
if (key.isEmpty()) {
157
- throw Exception (" Cannot add tag with empty key" )
169
+ Logging .log(LogLevel .ERROR , " Cannot add tag with empty key" )
170
+ return
158
171
}
159
172
160
173
_propertiesModel .tags[key] = value
@@ -165,7 +178,8 @@ internal open class UserManager(
165
178
166
179
tags.forEach {
167
180
if (it.key.isEmpty()) {
168
- throw Exception (" Cannot add tag with empty key" )
181
+ Logging .log(LogLevel .ERROR , " Cannot add tag with empty key" )
182
+ return
169
183
}
170
184
}
171
185
@@ -178,7 +192,8 @@ internal open class UserManager(
178
192
Logging .log(LogLevel .DEBUG , " removeTag(key: $key )" )
179
193
180
194
if (key.isEmpty()) {
181
- throw Exception (" Cannot remove tag with empty key" )
195
+ Logging .log(LogLevel .ERROR , " Cannot remove tag with empty key" )
196
+ return
182
197
}
183
198
184
199
_propertiesModel .tags.remove(key)
@@ -189,7 +204,8 @@ internal open class UserManager(
189
204
190
205
keys.forEach {
191
206
if (it.isEmpty()) {
192
- throw Exception (" Cannot remove tag with empty key" )
207
+ Logging .log(LogLevel .ERROR , " Cannot remove tag with empty key" )
208
+ return
193
209
}
194
210
}
195
211
0 commit comments