UNPKG

3.85 kBTypeScriptView Raw
1import type { Span } from '@sentry/types';
2/** The status of an Span.
3 *
4 * @deprecated Use string literals - if you require type casting, cast to SpanStatusType type
5 */
6export declare enum SpanStatus {
7 /** The operation completed successfully. */
8 Ok = "ok",
9 /** Deadline expired before operation could complete. */
10 DeadlineExceeded = "deadline_exceeded",
11 /** 401 Unauthorized (actually does mean unauthenticated according to RFC 7235) */
12 Unauthenticated = "unauthenticated",
13 /** 403 Forbidden */
14 PermissionDenied = "permission_denied",
15 /** 404 Not Found. Some requested entity (file or directory) was not found. */
16 NotFound = "not_found",
17 /** 429 Too Many Requests */
18 ResourceExhausted = "resource_exhausted",
19 /** Client specified an invalid argument. 4xx. */
20 InvalidArgument = "invalid_argument",
21 /** 501 Not Implemented */
22 Unimplemented = "unimplemented",
23 /** 503 Service Unavailable */
24 Unavailable = "unavailable",
25 /** Other/generic 5xx. */
26 InternalError = "internal_error",
27 /** Unknown. Any non-standard HTTP status code. */
28 UnknownError = "unknown_error",
29 /** The operation was cancelled (typically by the user). */
30 Cancelled = "cancelled",
31 /** Already exists (409) */
32 AlreadyExists = "already_exists",
33 /** Operation was rejected because the system is not in a state required for the operation's */
34 FailedPrecondition = "failed_precondition",
35 /** The operation was aborted, typically due to a concurrency issue. */
36 Aborted = "aborted",
37 /** Operation was attempted past the valid range. */
38 OutOfRange = "out_of_range",
39 /** Unrecoverable data loss or corruption */
40 DataLoss = "data_loss"
41}
42export type SpanStatusType =
43/** The operation completed successfully. */
44'ok'
45/** Deadline expired before operation could complete. */
46 | 'deadline_exceeded'
47/** 401 Unauthorized (actually does mean unauthenticated according to RFC 7235) */
48 | 'unauthenticated'
49/** 403 Forbidden */
50 | 'permission_denied'
51/** 404 Not Found. Some requested entity (file or directory) was not found. */
52 | 'not_found'
53/** 429 Too Many Requests */
54 | 'resource_exhausted'
55/** Client specified an invalid argument. 4xx. */
56 | 'invalid_argument'
57/** 501 Not Implemented */
58 | 'unimplemented'
59/** 503 Service Unavailable */
60 | 'unavailable'
61/** Other/generic 5xx. */
62 | 'internal_error'
63/** Unknown. Any non-standard HTTP status code. */
64 | 'unknown_error'
65/** The operation was cancelled (typically by the user). */
66 | 'cancelled'
67/** Already exists (409) */
68 | 'already_exists'
69/** Operation was rejected because the system is not in a state required for the operation's */
70 | 'failed_precondition'
71/** The operation was aborted, typically due to a concurrency issue. */
72 | 'aborted'
73/** Operation was attempted past the valid range. */
74 | 'out_of_range'
75/** Unrecoverable data loss or corruption */
76 | 'data_loss';
77/**
78 * Converts a HTTP status code into a {@link SpanStatusType}.
79 *
80 * @param httpStatus The HTTP response status code.
81 * @returns The span status or unknown_error.
82 */
83export declare function getSpanStatusFromHttpCode(httpStatus: number): SpanStatusType;
84/**
85 * Converts a HTTP status code into a {@link SpanStatusType}.
86 *
87 * @deprecated Use {@link spanStatusFromHttpCode} instead.
88 * This export will be removed in v8 as the signature contains a typo.
89 *
90 * @param httpStatus The HTTP response status code.
91 * @returns The span status or unknown_error.
92 */
93export declare const spanStatusfromHttpCode: typeof getSpanStatusFromHttpCode;
94/**
95 * Sets the Http status attributes on the current span based on the http code.
96 * Additionally, the span's status is updated, depending on the http code.
97 */
98export declare function setHttpStatus(span: Span, httpStatus: number): void;
99//# sourceMappingURL=spanstatus.d.ts.map
\No newline at end of file