@@ -362,8 +362,6 @@ pub use crate::exporter::{
362
362
OTEL_EXPORTER_OTLP_TIMEOUT_DEFAULT ,
363
363
} ;
364
364
365
- use opentelemetry_sdk:: ExportError ;
366
-
367
365
/// Type to indicate the builder does not have a client set.
368
366
#[ derive( Debug , Default , Clone ) ]
369
367
pub struct NoExporterBuilderSet ;
@@ -391,104 +389,6 @@ pub use crate::exporter::tonic::{TonicConfig, TonicExporterBuilder};
391
389
#[ cfg( feature = "serialize" ) ]
392
390
use serde:: { Deserialize , Serialize } ;
393
391
394
- /// Wrap type for errors from this crate.
395
- #[ derive( thiserror:: Error , Debug ) ]
396
- pub enum Error {
397
- /// Wrap error from [`tonic::transport::Error`]
398
- #[ cfg( feature = "grpc-tonic" ) ]
399
- #[ error( "transport error {0}" ) ]
400
- Transport ( #[ from] tonic:: transport:: Error ) ,
401
-
402
- /// Wrap the [`tonic::codegen::http::uri::InvalidUri`] error
403
- #[ cfg( any( feature = "grpc-tonic" , feature = "http-proto" , feature = "http-json" ) ) ]
404
- #[ error( "invalid URI {0}" ) ]
405
- InvalidUri ( #[ from] http:: uri:: InvalidUri ) ,
406
-
407
- /// Wrap type for [`tonic::Status`]
408
- #[ cfg( feature = "grpc-tonic" ) ]
409
- #[ error( "the grpc server returns error ({code}): {message}" ) ]
410
- Status {
411
- /// grpc status code
412
- code : tonic:: Code ,
413
- /// error message
414
- message : String ,
415
- } ,
416
-
417
- /// Http requests failed because no http client is provided.
418
- #[ cfg( any( feature = "http-proto" , feature = "http-json" ) ) ]
419
- #[ error(
420
- "no http client, you must select one from features or provide your own implementation"
421
- ) ]
422
- NoHttpClient ,
423
-
424
- /// Http requests failed.
425
- #[ cfg( any( feature = "http-proto" , feature = "http-json" ) ) ]
426
- #[ error( "http request failed with {0}" ) ]
427
- RequestFailed ( #[ from] opentelemetry_http:: HttpError ) ,
428
-
429
- /// The provided value is invalid in HTTP headers.
430
- #[ cfg( any( feature = "grpc-tonic" , feature = "http-proto" , feature = "http-json" ) ) ]
431
- #[ error( "http header value error {0}" ) ]
432
- InvalidHeaderValue ( #[ from] http:: header:: InvalidHeaderValue ) ,
433
-
434
- /// The provided name is invalid in HTTP headers.
435
- #[ cfg( any( feature = "grpc-tonic" , feature = "http-proto" , feature = "http-json" ) ) ]
436
- #[ error( "http header name error {0}" ) ]
437
- InvalidHeaderName ( #[ from] http:: header:: InvalidHeaderName ) ,
438
-
439
- /// Prost encode failed
440
- #[ cfg( any(
441
- feature = "http-proto" ,
442
- all( feature = "http-json" , not( feature = "trace" ) )
443
- ) ) ]
444
- #[ error( "prost encoding error {0}" ) ]
445
- EncodeError ( #[ from] prost:: EncodeError ) ,
446
-
447
- /// The lock in exporters has been poisoned.
448
- #[ cfg( feature = "metrics" ) ]
449
- #[ error( "the lock of the {0} has been poisoned" ) ]
450
- PoisonedLock ( & ' static str ) ,
451
-
452
- /// Unsupported compression algorithm.
453
- #[ error( "unsupported compression algorithm '{0}'" ) ]
454
- UnsupportedCompressionAlgorithm ( String ) ,
455
-
456
- /// Feature required to use the specified compression algorithm.
457
- #[ cfg( any( not( feature = "gzip-tonic" ) , not( feature = "zstd-tonic" ) ) ) ]
458
- #[ error( "feature '{0}' is required to use the compression algorithm '{1}'" ) ]
459
- FeatureRequiredForCompressionAlgorithm ( & ' static str , Compression ) ,
460
- }
461
-
462
- #[ cfg( feature = "grpc-tonic" ) ]
463
- impl From < tonic:: Status > for Error {
464
- fn from ( status : tonic:: Status ) -> Error {
465
- Error :: Status {
466
- code : status. code ( ) ,
467
- message : {
468
- if !status. message ( ) . is_empty ( ) {
469
- let mut result = ", detailed error message: " . to_string ( ) + status. message ( ) ;
470
- if status. code ( ) == tonic:: Code :: Unknown {
471
- let source = ( & status as & dyn std:: error:: Error )
472
- . source ( )
473
- . map ( |e| format ! ( "{:?}" , e) ) ;
474
- result. push ( ' ' ) ;
475
- result. push_str ( source. unwrap_or_default ( ) . as_ref ( ) ) ;
476
- }
477
- result
478
- } else {
479
- String :: new ( )
480
- }
481
- } ,
482
- }
483
- }
484
- }
485
-
486
- impl ExportError for Error {
487
- fn exporter_name ( & self ) -> & ' static str {
488
- "otlp"
489
- }
490
- }
491
-
492
392
/// The communication protocol to use when exporting data.
493
393
#[ cfg_attr( feature = "serialize" , derive( Deserialize , Serialize ) ) ]
494
394
#[ derive( Clone , Copy , Debug , Eq , PartialEq ) ]
0 commit comments