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
use ExportError;
use crateConstraintError;
/// Errors that can occur when translating an OpenTelemetry span to an X-Ray segment.
///
/// These errors represent failures during the translation of individual spans,
/// including missing required span data and constraint violations in the resulting
/// segment documents. The [`SegmentTranslator::translate_spans`] method handles
/// these errors internally — spans that fail translation are silently dropped
/// and logged (when the `internal-logs` feature is enabled) rather than
/// propagated to the caller.
///
/// [`SegmentTranslator::translate_spans`]: crate::xray_exporter::SegmentTranslator::translate_spans
///
/// # Examples
///
/// Matching on error variants:
///
/// ```
/// use opentelemetry_aws::xray_exporter::error::{TranslationError, ConstraintError};
///
/// fn handle_translation_error(err: TranslationError) {
/// match err {
/// TranslationError::MissingSpanId => {
/// eprintln!("span is missing a valid span ID");
/// }
/// TranslationError::ConstraintError(constraint) => {
/// eprintln!("segment constraint violated: {constraint}");
/// }
/// }
/// }
/// ```
pub type Result<T> = Result;