Skip to content

Commit

Permalink
fix: do not throw exception in case of empty url
Browse files Browse the repository at this point in the history
In case of an empty `url` parameter, the SDK should not crash the application. The logging SDK is likely not as critical to the consumer business flow to the degree, that providing an incorrect argument would kill the whole process.
  • Loading branch information
wzieba committed Dec 13, 2023
1 parent 4f3f0e7 commit bf8bcbb
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,8 @@ public void trackPageview(
@Nullable ParselyMetadata urlMetadata,
@Nullable Map<String, Object> extraData) {
if (url.equals("")) {
throw new IllegalArgumentException("url cannot be null or empty.");
log("url cannot be empty");
return;
}

// Blank urlref is better than null
Expand Down Expand Up @@ -262,7 +263,8 @@ public void startEngagement(
final @Nullable Map<String, Object> extraData
) {
if (url.equals("")) {
throw new IllegalArgumentException("url cannot be null or empty.");
log("url cannot be empty");
return;
}

// Blank urlref is better than null
Expand Down Expand Up @@ -320,7 +322,8 @@ public void trackPlay(
@NonNull ParselyVideoMetadata videoMetadata,
@Nullable Map<String, Object> extraData) {
if (url.equals("")) {
throw new IllegalArgumentException("url cannot be null or empty.");
log("url cannot be empty");
return;
}

// Blank urlref is better than null
Expand Down

0 comments on commit bf8bcbb

Please sign in to comment.