-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathAudienceError.cs
More file actions
81 lines (74 loc) · 2.52 KB
/
Copy pathAudienceError.cs
File metadata and controls
81 lines (74 loc) · 2.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
using System;
namespace Immutable.Audience
{
/// <summary>
/// Categorises errors raised through <see cref="AudienceConfig.OnError"/>.
/// </summary>
public enum AudienceErrorCode
{
/// <summary>
/// An event batch failed to flush.
/// </summary>
/// <remarks>
/// Either a local storage read error (batch dropped) or a non-2xx /
/// non-4xx server response, typically 5xx (batch retained and retried
/// with backoff).
/// </remarks>
FlushFailed,
/// <summary>
/// Server rejected an event batch with a 4xx status.
/// </summary>
/// <remarks>
/// The batch was dropped. Retrying will not help (typically indicates
/// a malformed payload).
/// </remarks>
ValidationRejected,
/// <summary>
/// Failed to sync a consent change to the backend.
/// </summary>
/// <remarks>
/// The local consent level has already been applied. The server-side
/// audit trail may be out of date.
/// </remarks>
ConsentSyncFailed,
/// <summary>
/// A network call failed.
/// </summary>
/// <remarks>
/// Causes include exceptions, timeouts, or a non-2xx response on data
/// deletion. Event batches are retained for retry. Data-delete
/// requests are not retried automatically.
/// </remarks>
NetworkError,
/// <summary>
/// Failed to persist the consent level to disk.
/// </summary>
/// <remarks>
/// The in-memory level is still applied but will revert on next
/// launch.
/// </remarks>
ConsentPersistFailed
}
/// <summary>
/// Error raised through <see cref="AudienceConfig.OnError"/> when the SDK
/// encounters a recoverable failure.
/// </summary>
public class AudienceError : Exception
{
/// <summary>
/// The reason this error was raised.
/// </summary>
public AudienceErrorCode Code { get; }
/// <summary>
/// Wraps a code and message into an <see cref="AudienceError"/> for
/// delivery through <see cref="AudienceConfig.OnError"/>.
/// </summary>
/// <param name="code">The reason for the failure.</param>
/// <param name="message">Human-readable description.</param>
public AudienceError(AudienceErrorCode code, string message)
: base(message)
{
Code = code;
}
}
}