UNPKG

1.59 kBJavaScriptView Raw
1Object.defineProperty(exports, "__esModule", { value: true });
2/** The status of an event. */
3// eslint-disable-next-line import/export
4var Status;
5(function (Status) {
6 /** The status could not be determined. */
7 Status["Unknown"] = "unknown";
8 /** The event was skipped due to configuration or callbacks. */
9 Status["Skipped"] = "skipped";
10 /** The event was sent to Sentry successfully. */
11 Status["Success"] = "success";
12 /** The client is currently rate limited and will try again later. */
13 Status["RateLimit"] = "rate_limit";
14 /** The event could not be processed. */
15 Status["Invalid"] = "invalid";
16 /** A server-side error occurred during submission. */
17 Status["Failed"] = "failed";
18})(Status = exports.Status || (exports.Status = {}));
19// eslint-disable-next-line @typescript-eslint/no-namespace, import/export
20(function (Status) {
21 /**
22 * Converts a HTTP status code into a {@link Status}.
23 *
24 * @param code The HTTP response status code.
25 * @returns The send status or {@link Status.Unknown}.
26 */
27 function fromHttpCode(code) {
28 if (code >= 200 && code < 300) {
29 return Status.Success;
30 }
31 if (code === 429) {
32 return Status.RateLimit;
33 }
34 if (code >= 400 && code < 500) {
35 return Status.Invalid;
36 }
37 if (code >= 500) {
38 return Status.Failed;
39 }
40 return Status.Unknown;
41 }
42 Status.fromHttpCode = fromHttpCode;
43})(Status = exports.Status || (exports.Status = {}));
44//# sourceMappingURL=status.js.map
\No newline at end of file