BlockReasonException

An exception thrown when a Chapter is blocked for a specific reason. The specific reason is indicated by the type of BlockReasonException thrown.

Each subclass of BlockReasonException corresponds to a specific BlockReason and provides a messageResId containing a user-friendly localized message describing the block reason.

Checking the blocking reason

val exception: BlockReasonException
when (exception) {
is BlockReasonException.GeoBlock -> Log.d("Pillarbox", "This chapter is geo-blocked")
is BlockReasonException.StartDate -> Log.d("Pillarbox", "This chapter will be available on ${exception.instant}.")
is BlockReasonException.EndDate -> Log.d("Pillarbox", "This chapter is no longer available since ${exception.instant}.")
// Handle other types...
}

Parameters

message

The exception message.

Inheritors

Types

Link copied to clipboard

Represents an exception thrown when a Chapter is blocked due to an age rating of 12. This corresponds to BlockReason.AGERATING12.

Link copied to clipboard

Represents an exception thrown when a Chapter is blocked due to an age rating of 18. This corresponds to BlockReason.AGERATING18.

Link copied to clipboard

Represents an exception thrown when a Chapter is blocked for commercial reason. This corresponds to BlockReason.COMMERCIAL.

Link copied to clipboard
class EndDate(val instant: Instant?) : BlockReasonException

Represents an exception thrown when a Chapter is blocked due to reaching its end date. This corresponds to BlockReason.ENDDATE.

Link copied to clipboard

Represents an exception thrown when a Chapter is blocked due to geographical restrictions. This corresponds to BlockReason.GEOBLOCK.

Link copied to clipboard

Represents an exception thrown when a Chapter is blocked for journalistic reason. This corresponds to BlockReason.JOURNALISTIC.

Link copied to clipboard

Represents an exception thrown when a Chapter is blocked due to legal reasons. This corresponds to BlockReason.LEGAL.

Link copied to clipboard
class StartDate(val instant: Instant?) : BlockReasonException

Represents an exception thrown when a Chapter is blocked due to its start date being in the future. This corresponds to BlockReason.STARTDATE.

Link copied to clipboard

Represents an exception thrown when a Chapter is blocked for an unknown reason. This corresponds to BlockReason.UNKNOWN.

Properties

Link copied to clipboard
open val cause: Throwable?
Link copied to clipboard
open override val localizedMessage: String?
Link copied to clipboard
open val message: String?
Link copied to clipboard

An Android resource id pointing to a localized string describing the block reason.

Link copied to clipboard
open override var stackTrace: Array<out StackTraceElement?>?
Link copied to clipboard
override val suppressed: Array<out Throwable?>?