Skip to content

Core errors

A type that you use to check the cause when you branch to Failure. It holds problems that are not feature-level results, such as network failures, timeouts, server errors, and platform errors.

Feature-level results are not held here. Branch on the Outcome that each method declares. For the difference between the two branches, see Result model.

HiveError

class — namespace Hive.Axyl.Core

The detailed information of Failure. Get it with Failure.Problem or IAxylResult.UntypedProblem. It cannot be changed after creation.

Properties

Property Type Required Description
Code HiveErrorCode Required The code that classifies the failure.
Message string Required The diagnostic message developers use to check the cause. It is in English.
ExternalCode string? Optional The original error code provided by an external system or platform. Example: HTTP 500, Net_Offline, BillingResponse:ITEM_ALREADY_OWNED.
TraceId string? Optional The identifier that tracks the request on the server side. It is included only when the SDK's native layer passes this value; otherwise, it is null.
Details IReadOnlyDictionary<string, string>? Optional Additional platform-specific key-value information. It is not filled in by the current Unity implementation and is always null.
Type string? Optional The URI that identifies the error type. It is included only in failures that come from a server response, and it is null in Add-on failures.
Instance string? Optional The request path where the error occurred. It is included only in failures that come from a server response, and it is null in Add-on failures.

First, distinguish the failure type with Code. When you investigate the cause, check Message and ExternalCode together. For how to handle each value, see Handling by failure cause.

Do not show Message to users

Message is an English diagnostic message for developers and is not localized. Messages that come from a network response are truncated at 256 characters. Show app users text that the app has prepared for each Code.

ToString() outputs in the [Code] Message format and appends ExternalCode at the end if it exists.

HiveErrorCode

enum — namespace Hive.Axyl.Core

The code that classifies failures. Its values map 1:1 to the gRPC status codes (0-16).

Feature-level results are not included in this enum.

C# member Value Description
OK 0 A value that indicates there is no transport error. It is not used in Failure.
Cancelled 1 The code canceled the operation. This is usually a cancellation by a CancellationToken.
Unknown 2 An error that cannot be classified under another code.
InvalidArgument 3 The request arguments are invalid.
DeadlineExceeded 4 The server responded with 504. When the request timeout elapses, Unavailable is returned instead of this code.
NotFound 5 The server responded with 404, or the Add-on could not find the requested product or purchase. When a resource is not found at the feature level, it is delivered as an Outcome instead of this code.
AlreadyExists 6 A conflict occurred because the resource already exists.
PermissionDenied 7 Authentication succeeded, but there is no permission for the operation.
ResourceExhausted 8 The request limit, quota, or queue capacity is exhausted.
FailedPrecondition 9 The state required for the operation is not ready. This includes the case where the SDK is not initialized.
Aborted 10 The operation was aborted, for example because of a concurrency conflict.
OutOfRange 11 The value is outside the allowed range.
Unimplemented 12 The feature is not implemented or not supported.
Internal 13 An internal SDK or server error occurred, or the response could not be read.
Unavailable 14 The call could not be completed because of a network disconnection or a temporary service interruption. Whether you can retry depends on ExternalCode, so see Handling by failure cause.
DataLoss 15 Unrecoverable data loss or corruption occurred.
Unauthenticated 16 The credentials are missing or invalid.

RegistrationNotFoundException

class — namespace Hive.Axyl.Core

Thrown when HiveCore.Resolve<T>() is asked for a type that is not registered. It inherits from InvalidOperationException.

Property Type Required Description
ContractType Type Required The type that is not registered.

This exception is mostly a problem in the initialization code. Check that the module is registered in the registration closure of HiveBootstrap.Initialize.

Add-ons are registered only on supported platforms, so when you retrieve an Add-on, use HiveCore.TryResolve<T>() to check first whether it is registered.