Skip to content

Exceptions#

Exceptions are available directly in the mojang module, which means mojang.errors itself does not need to be imported. For example, mojang.errors.MojangError is available as mojang.MojangError.

mojang.errors.MojangError #

Bases: Exception

Base error class for all library-related exceptions in this file. Essentially, this could be caught to handle any exceptions thrown from this library.

mojang.errors.BadRequest #

Bases: MojangError

HTTP 400. The server could not process our request, likely due to an error of ours.

mojang.errors.Unauthorized #

Bases: MojangError

HTTP 401. We are not authorized to access the requested resource. This can occur due to an invalid or expired Bearer token.

mojang.errors.Forbidden #

Bases: MojangError

HTTP 403. We do not have permission to access the requested resource.

mojang.errors.NotFound #

Bases: MojangError

HTTP 404. This resource does not exist.

mojang.errors.TooManyRequests #

Bases: MojangError

HTTP 429. The server is ratelimiting us. Please wait for a bit before trying again.

mojang.errors.ServerError #

Bases: MojangError

HTTP 5xx. The server encountered an unexpected condition that prevented it from fulfilling the request.

mojang.errors.LoginFailure #

Bases: MojangError

The login process failed for some reason. This can occur due to an incorrect email or password.

mojang.errors.MissingMinecraftLicense #

Bases: MojangError

The Microsoft account is valid, but it is missing a Minecraft license.

mojang.errors.MissingMinecraftProfile #

Bases: MojangError

The account has a Minecraft license, but it hasn't created a profile yet.