sdk: LoginWithCustomAsync + regenerated auth models
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
|
||||
namespace RudderSdk.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Base exception for every API failure. Carries the HTTP status code
|
||||
/// (0 for network failures, see <see cref="RudderNetworkException"/>), the
|
||||
/// machine-readable API error code (see <see cref="RudderErrorCodes"/>) and the
|
||||
/// server-issued request id when available.
|
||||
/// </summary>
|
||||
public class RudderApiException : Exception
|
||||
{
|
||||
/// <summary>HTTP status code, or 0 when the request never reached the server.</summary>
|
||||
public int StatusCode { get; }
|
||||
|
||||
/// <summary>Machine-readable API error code, or an empty string.</summary>
|
||||
public string Code { get; }
|
||||
|
||||
/// <summary>Server-issued request id for support tickets, or null.</summary>
|
||||
public string? RequestId { get; }
|
||||
|
||||
/// <summary>Creates the exception.</summary>
|
||||
public RudderApiException(int statusCode, string? code, string message, string? requestId = null)
|
||||
: base(message)
|
||||
{
|
||||
StatusCode = statusCode;
|
||||
Code = code ?? string.Empty;
|
||||
RequestId = requestId;
|
||||
}
|
||||
|
||||
/// <summary>Creates the exception wrapping an inner transport error.</summary>
|
||||
public RudderApiException(int statusCode, string? code, string message, string? requestId, Exception? innerException)
|
||||
: base(message, innerException)
|
||||
{
|
||||
StatusCode = statusCode;
|
||||
Code = code ?? string.Empty;
|
||||
RequestId = requestId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
namespace RudderSdk.Core;
|
||||
|
||||
/// <summary>
|
||||
/// The server rejected the request as unauthenticated (HTTP 401). The SDK
|
||||
/// attempts a token refresh before surfacing this; seeing it means the session
|
||||
/// is over and the player must sign in again.
|
||||
/// </summary>
|
||||
public sealed class RudderAuthException : RudderApiException
|
||||
{
|
||||
/// <summary>Creates the exception.</summary>
|
||||
public RudderAuthException(int statusCode, string? code, string message, string? requestId = null)
|
||||
: base(statusCode, code, message, requestId)
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
|
||||
namespace RudderSdk.Core;
|
||||
|
||||
/// <summary>
|
||||
/// The request never got a response: DNS/connectivity failure or client-side
|
||||
/// timeout. <see cref="RudderApiException.StatusCode"/> is 0. Retrying is safe
|
||||
/// for idempotent operations.
|
||||
/// </summary>
|
||||
public sealed class RudderNetworkException : RudderApiException
|
||||
{
|
||||
/// <summary>Creates the exception.</summary>
|
||||
public RudderNetworkException(string message, Exception? innerException = null)
|
||||
: base(0, string.Empty, message, null, innerException)
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace RudderSdk.Core;
|
||||
|
||||
/// <summary>The requested resource does not exist (HTTP 404).</summary>
|
||||
public sealed class RudderNotFoundException : RudderApiException
|
||||
{
|
||||
/// <summary>Creates the exception.</summary>
|
||||
public RudderNotFoundException(int statusCode, string? code, string message, string? requestId = null)
|
||||
: base(statusCode, code, message, requestId)
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace RudderSdk.Core;
|
||||
|
||||
/// <summary>The client hit a server rate limit (HTTP 429); back off and retry later.</summary>
|
||||
public sealed class RudderRateLimitException : RudderApiException
|
||||
{
|
||||
/// <summary>Creates the exception.</summary>
|
||||
public RudderRateLimitException(int statusCode, string? code, string message, string? requestId = null)
|
||||
: base(statusCode, code, message, requestId)
|
||||
{
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user