# SessionError

Artifact: [androidx.media3:media3-session](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/session/SessionError.java+class:androidx.media3.session.SessionError)

*** ** * ** ***


```
public final class SessionError
```

<br />

*** ** * ** ***

Provides information about a session error.

## Summary

| ### Nested types |
|---|
| `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi @https://developer.android.com/reference/java/lang/annotation/Documented.html @https://developer.android.com/reference/java/lang/annotation/Retention.html(value = https://developer.android.com/reference/java/lang/annotation/RetentionPolicy.html#SOURCE) @https://developer.android.com/reference/java/lang/annotation/Target.html(value = https://developer.android.com/reference/java/lang/annotation/ElementType.html#TYPE_USE) @https://developer.android.com/reference/androidx/annotation/IntDef(value = ) public annotation https://developer.android.com/reference/androidx/media3/session/SessionError.Code` Info and error result codes. |

| ### Constants |
|---|---|
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/SessionError#ERROR_BAD_VALUE() = -3` Error code representing that an argument is illegal. |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/SessionError#ERROR_INVALID_STATE() = -2` Error code representing that the command cannot be completed because the current state is not valid for the command. |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/SessionError#ERROR_IO() = -5` Error code representing that a file or network related error happened. |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/SessionError#ERROR_NOT_SUPPORTED() = -6` Error code representing that the command is not supported. |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/SessionError#ERROR_PERMISSION_DENIED() = -4` Error code representing that the command is not allowed. |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/SessionError#ERROR_SESSION_AUTHENTICATION_EXPIRED() = -102` Error code representing that the authentication has expired. |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/SessionError#ERROR_SESSION_CONCURRENT_STREAM_LIMIT() = -104` Error code representing that too many concurrent streams are detected. |
| `static final int` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/session/SessionError#ERROR_SESSION_CONTENT_ALREADY_PLAYING() = -110` Error code representing that the requested content is already playing. |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/SessionError#ERROR_SESSION_DISCONNECTED() = -100` Error code representing that the session and controller were disconnected. |
| `static final int` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/session/SessionError#ERROR_SESSION_END_OF_PLAYLIST() = -109` Error code representing that navigation failed because the playlist was exhausted. |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/SessionError#ERROR_SESSION_NOT_AVAILABLE_IN_REGION() = -106` Error code representing that the content is blocked due to being regionally unavailable. |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/SessionError#ERROR_SESSION_PARENTAL_CONTROL_RESTRICTED() = -105` Error code representing that the content is blocked due to parental controls. |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/SessionError#ERROR_SESSION_PREMIUM_ACCOUNT_REQUIRED() = -103` Error code representing that a premium account is required. |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/SessionError#ERROR_SESSION_SETUP_REQUIRED() = -108` Error code representing that the session needs user's manual intervention. |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/SessionError#ERROR_SESSION_SKIP_LIMIT_REACHED() = -107` Error code representing that the application cannot skip any more because the skip limit is reached. |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/SessionError#ERROR_UNKNOWN() = -1` Error code representing that the command is ended with an unknown error. |
| `static final int` | `https://developer.android.com/reference/androidx/media3/session/SessionError#INFO_CANCELLED() = 1` Info code representing that the command was cancelled. |

| ### Public fields |
|---|---|
| `int` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi @https://developer.android.com/reference/androidx/media3/session/SessionError.Code https://developer.android.com/reference/androidx/media3/session/SessionError#code()` |
| `https://developer.android.com/reference/android/os/Bundle.html` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/session/SessionError#extras()` |
| `https://developer.android.com/reference/java/lang/String.html` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/session/SessionError#message()` |

| ### Public constructors |
|---|
| `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/session/SessionError#SessionError(int,java.lang.String)(@https://developer.android.com/reference/androidx/media3/session/SessionError.Code int code, https://developer.android.com/reference/java/lang/String.html message)` Creates an instance with `https://developer.android.com/reference/android/os/Bundle.html#EMPTY`. |
| `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/session/SessionError#SessionError(int,java.lang.String,android.os.Bundle)(@https://developer.android.com/reference/androidx/media3/session/SessionError.Code int code, https://developer.android.com/reference/java/lang/String.html message, https://developer.android.com/reference/android/os/Bundle.html extras)` Creates an instance. |

| ### Public methods |
|---|---|
| `boolean` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/session/SessionError#equals(java.lang.Object)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/Object.html o)` Checks the given error for equality while ignoring `https://developer.android.com/reference/androidx/media3/session/SessionError#extras()`. |
| `static https://developer.android.com/reference/androidx/media3/session/SessionError` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/session/SessionError#fromBundle(android.os.Bundle)(https://developer.android.com/reference/android/os/Bundle.html bundle)` Restores a `SessionError` from a `https://developer.android.com/reference/android/os/Bundle.html`. |
| `static https://developer.android.com/reference/java/lang/String.html` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/session/SessionError#getErrorCodeName(int)(@https://developer.android.com/reference/androidx/media3/session/SessionError.Code int errorCode)` Returns the name of a given error code. |
| `int` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/session/SessionError#hashCode()()` |
| `https://developer.android.com/reference/android/os/Bundle.html` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/session/SessionError#toBundle()()` Returns a `https://developer.android.com/reference/android/os/Bundle.html` representing the information stored in this object. |

## Constants

### ERROR_BAD_VALUE

```
public static final int ERROR_BAD_VALUE = -3
```

Error code representing that an argument is illegal.

### ERROR_INVALID_STATE

```
public static final int ERROR_INVALID_STATE = -2
```

Error code representing that the command cannot be completed because the current state is not valid for the command.

### ERROR_IO

```
public static final int ERROR_IO = -5
```

Error code representing that a file or network related error happened.

### ERROR_NOT_SUPPORTED

```
public static final int ERROR_NOT_SUPPORTED = -6
```

Error code representing that the command is not supported.

### ERROR_PERMISSION_DENIED

```
public static final int ERROR_PERMISSION_DENIED = -4
```

Error code representing that the command is not allowed.

### ERROR_SESSION_AUTHENTICATION_EXPIRED

```
public static final int ERROR_SESSION_AUTHENTICATION_EXPIRED = -102
```

Error code representing that the authentication has expired.

### ERROR_SESSION_CONCURRENT_STREAM_LIMIT

```
public static final int ERROR_SESSION_CONCURRENT_STREAM_LIMIT = -104
```

Error code representing that too many concurrent streams are detected.

### ERROR_SESSION_CONTENT_ALREADY_PLAYING

```
@UnstableApi
public static final int ERROR_SESSION_CONTENT_ALREADY_PLAYING = -110
```

Error code representing that the requested content is already playing.

### ERROR_SESSION_DISCONNECTED

```
public static final int ERROR_SESSION_DISCONNECTED = -100
```

Error code representing that the session and controller were disconnected.

### ERROR_SESSION_END_OF_PLAYLIST

```
@UnstableApi
public static final int ERROR_SESSION_END_OF_PLAYLIST = -109
```

Error code representing that navigation failed because the playlist was exhausted.

### ERROR_SESSION_NOT_AVAILABLE_IN_REGION

```
public static final int ERROR_SESSION_NOT_AVAILABLE_IN_REGION = -106
```

Error code representing that the content is blocked due to being regionally unavailable.

### ERROR_SESSION_PARENTAL_CONTROL_RESTRICTED

```
public static final int ERROR_SESSION_PARENTAL_CONTROL_RESTRICTED = -105
```

Error code representing that the content is blocked due to parental controls.

### ERROR_SESSION_PREMIUM_ACCOUNT_REQUIRED

```
public static final int ERROR_SESSION_PREMIUM_ACCOUNT_REQUIRED = -103
```

Error code representing that a premium account is required.

### ERROR_SESSION_SETUP_REQUIRED

```
public static final int ERROR_SESSION_SETUP_REQUIRED = -108
```

Error code representing that the session needs user's manual intervention.

### ERROR_SESSION_SKIP_LIMIT_REACHED

```
public static final int ERROR_SESSION_SKIP_LIMIT_REACHED = -107
```

Error code representing that the application cannot skip any more because the skip limit is reached.

### ERROR_UNKNOWN

```
public static final int ERROR_UNKNOWN = -1
```

Error code representing that the command is ended with an unknown error.

### INFO_CANCELLED

```
public static final int INFO_CANCELLED = 1
```

Info code representing that the command was cancelled.

## Public fields

### code

```
@UnstableApi
@SessionError.Code
public int code
```

### extras

```
@UnstableApi
public Bundle extras
```

### message

```
@UnstableApi
public String message
```

## Public constructors

### SessionError

```
@UnstableApi
public SessionError(@SessionError.Code int code, String message)
```

Creates an instance with `https://developer.android.com/reference/android/os/Bundle.html#EMPTY`.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/media3/session/SessionError.Code int code` | The error result code. |
| `https://developer.android.com/reference/java/lang/String.html message` | The error message. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | if the result code is not an error result code. |

### SessionError

```
@UnstableApi
public SessionError(@SessionError.Code int code, String message, Bundle extras)
```

Creates an instance.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/media3/session/SessionError.Code int code` | The error result code. |
| `https://developer.android.com/reference/java/lang/String.html message` | The error message. |
| `https://developer.android.com/reference/android/os/Bundle.html extras` | The error extras. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | if the result code is not an error result code. |

## Public methods

### equals

```
@UnstableApi
public boolean equals(@Nullable Object o)
```

Checks the given error for equality while ignoring `https://developer.android.com/reference/androidx/media3/session/SessionError#extras()`.

### fromBundle

```
@UnstableApi
public static SessionError fromBundle(Bundle bundle)
```

Restores a `SessionError` from a `https://developer.android.com/reference/android/os/Bundle.html`.

### getErrorCodeName

```
@UnstableApi
public static String getErrorCodeName(@SessionError.Code int errorCode)
```

Returns the name of a given error code.

### hashCode

```
@UnstableApi
public int hashCode()
```

### toBundle

```
@UnstableApi
public Bundle toBundle()
```

Returns a `https://developer.android.com/reference/android/os/Bundle.html` representing the information stored in this object.