Skip to content

Commit

Permalink
Move builder creation log after required fields check
Browse files Browse the repository at this point in the history
  • Loading branch information
KacperKluka committed Nov 18, 2022
1 parent 75b6b05 commit 0c143bd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ internal data class PublisherBuilder(

@RequiresPermission(anyOf = [ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION])
override fun start(): Publisher {
logHandler?.v("$TAG Creating a publisher instance")
if (isMissingRequiredFields()) {
logHandler?.v("$TAG Creating a publisher instance failed due to missing required fields")
throw BuilderConfigurationIncompleteException()
}
logHandler?.v("$TAG Creating a publisher instance")
// All below fields are required and above code checks if they are nulls, so using !! should be safe from NPE
return DefaultPublisher(
DefaultAbly(connectionConfiguration!!, logHandler),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ internal data class SubscriberBuilder(
this.copy(logHandler = logHandler)

override suspend fun start(): Subscriber {
logHandler?.v("$TAG Creating a subscriber instance")
if (isMissingRequiredFields()) {
logHandler?.v("$TAG Creating a subscriber instance failed due to missing required fields")
throw BuilderConfigurationIncompleteException()
}
logHandler?.v("$TAG Creating a subscriber instance")
// All below fields are required and above code checks if they are nulls, so using !! should be safe from NPE
return DefaultSubscriber(
DefaultAbly(connectionConfiguration!!, logHandler),
Expand Down

0 comments on commit 0c143bd

Please sign in to comment.