Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
138 commits
Select commit Hold shift + click to select a range
f178af8
Initial CosmosError refactoring
FabianMeiswinkel May 20, 2026
9912dd7
Updated PR link in changelogs
FabianMeiswinkel May 20, 2026
3eab366
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-rust in…
FabianMeiswinkel May 20, 2026
bebda3a
Adding Backtrace for CosmosError
FabianMeiswinkel May 20, 2026
1c4467f
Iterating on changes
FabianMeiswinkel May 21, 2026
1168dfa
Iterating on changes
FabianMeiswinkel May 21, 2026
7c80ff1
Avoid partially resolved backtraces
FabianMeiswinkel May 21, 2026
073d68c
Refactor azure_core:Error into DriverError earlier
FabianMeiswinkel May 21, 2026
d7afb56
clippy fixes
FabianMeiswinkel May 21, 2026
799a82c
<moving driver APIs to Cosmos Error
FabianMeiswinkel May 22, 2026
b2c32c5
Fixing build issues
FabianMeiswinkel May 22, 2026
af75f44
Update mod.rs
FabianMeiswinkel May 22, 2026
844d227
Merge remote-tracking branch 'upstream/main' into users/fabianm/Respo…
FabianMeiswinkel May 22, 2026
b7c99d7
Fix driver tests after upstream merge
FabianMeiswinkel May 22, 2026
e4f829a
Refactor: add Error::find_azure_core_error helper to centralise sourc…
FabianMeiswinkel May 22, 2026
d269530
Drop azure_core::Error source-chain walk in patch_handler
FabianMeiswinkel May 22, 2026
b7b5e52
remove mcp.json
FabianMeiswinkel May 22, 2026
7676daa
Drop redundant raw Headers field from TransportOutcome::HttpError
FabianMeiswinkel May 22, 2026
b130ba6
Updated changelogs
FabianMeiswinkel May 22, 2026
3be4ddf
Update mod.rs
FabianMeiswinkel May 22, 2026
bda0f76
Changed visibility
FabianMeiswinkel May 22, 2026
b66df50
Fixing Error message vs. to_string
FabianMeiswinkel May 22, 2026
ce0a7fc
Merge branch 'main' into users/fabianm/ResponseHeadersErrors
FabianMeiswinkel May 22, 2026
8e13393
Moving is_xxx helpers to CosmosStatus (and removing from errors)
FabianMeiswinkel May 24, 2026
a8ff99b
Merge branch 'main' into users/fabianm/ResponseHeadersErrors
FabianMeiswinkel May 24, 2026
ba55155
CosmosBacktrace --> Backtrace
FabianMeiswinkel May 24, 2026
c7e847e
Fixing build issues
FabianMeiswinkel May 24, 2026
9a6fd5e
Fixes clippy issues
FabianMeiswinkel May 24, 2026
a7850a6
Update diagnostics_context.rs
FabianMeiswinkel May 24, 2026
84bfb22
Forcing backtrace limiter capacity to be > 0
FabianMeiswinkel May 24, 2026
7a94382
Remove public Error factory methods in sdk
FabianMeiswinkel May 24, 2026
0e1fffe
Also adding limiter for captures
FabianMeiswinkel May 24, 2026
b16e0e9
Fixing inefficiency whenCosmso error wrapping another Cosmso error ba…
FabianMeiswinkel May 24, 2026
5597666
doc fix
FabianMeiswinkel May 24, 2026
27df1c6
Evict frame cache when more than 100K frames were cached
FabianMeiswinkel May 24, 2026
a58a58a
Fixed few NITs
FabianMeiswinkel May 26, 2026
a195ea1
Update mod.rs
FabianMeiswinkel May 26, 2026
8c858ea
Fixing doc errors
FabianMeiswinkel May 26, 2026
cf6f9bb
Deriving Clone for ErrorInner instead of identical explicit implement…
FabianMeiswinkel May 26, 2026
cd47474
Fixing TransportError
FabianMeiswinkel May 26, 2026
284a207
Fixed CosmosStatus Display
FabianMeiswinkel May 26, 2026
1328a9f
Update mod.rs
FabianMeiswinkel May 26, 2026
0fa85fd
Remove unsafe code for response header conversion
FabianMeiswinkel May 26, 2026
7a18c30
Adds specific CosmsoStatus for x-partition query not allowed
FabianMeiswinkel May 26, 2026
f84aa05
Fixing changelogs (removing excessive LFs)
FabianMeiswinkel May 26, 2026
501ad0a
Fixes code review feedback
FabianMeiswinkel May 26, 2026
48f5b87
Limit source chain to 64
FabianMeiswinkel May 26, 2026
1641700
Moving eviction of frames when reaching 100K limit to background thread.
FabianMeiswinkel May 26, 2026
24854da
Update backtrace.rs
FabianMeiswinkel May 26, 2026
63e2de0
Add source chain limit for Display as well
FabianMeiswinkel May 26, 2026
7d80068
Update backtrace.rs
FabianMeiswinkel May 26, 2026
9d1e1cf
Fixed code review feedback
FabianMeiswinkel May 26, 2026
5107224
doc update
FabianMeiswinkel May 26, 2026
0c19495
Fix backtrace return type
FabianMeiswinkel May 26, 2026
7850e63
Fix cspell errors
FabianMeiswinkel May 26, 2026
04b41ca
Fix docs issues
FabianMeiswinkel May 26, 2026
80bb3bc
Fixed some test failures
FabianMeiswinkel May 26, 2026
c570058
Update error.rs
FabianMeiswinkel May 26, 2026
fef0ce2
Fixing fmt errors
FabianMeiswinkel May 26, 2026
b644f6b
Update backtrace.rs
FabianMeiswinkel May 26, 2026
b794e61
Update connection_string.rs
FabianMeiswinkel May 26, 2026
bf98146
Fix infer_request_sent_status
FabianMeiswinkel May 26, 2026
bccc880
Make sure operation_pipeline maintains CosmosDaignosticsContext in ab…
FabianMeiswinkel May 26, 2026
81293c0
Remove Deserialize form CosmosStatus
FabianMeiswinkel May 26, 2026
2f1ebd6
Update backtrace.rs
FabianMeiswinkel May 26, 2026
0a96dd2
Fixing docs
FabianMeiswinkel May 26, 2026
913b3ad
Fixed docs
FabianMeiswinkel May 26, 2026
2a533a7
Removing dead status code tuples
FabianMeiswinkel May 26, 2026
67fedf4
Update patch_handler.rs
FabianMeiswinkel May 26, 2026
8b11b79
Removing error_placeholder from CosmsoDiagnosticsContext
FabianMeiswinkel May 26, 2026
f5cbdce
Fixing docs
FabianMeiswinkel May 26, 2026
0323e41
Added a benchmark
FabianMeiswinkel May 26, 2026
d212e9c
Converting internal azure_core::Error usage
FabianMeiswinkel May 27, 2026
85e5745
Removing more internal left-over usage of azure_core::Error
FabianMeiswinkel May 27, 2026
80d95c2
Move to ErrorBuilder
FabianMeiswinkel May 27, 2026
76d834f
Removing Error ctors in favor of a Builder
FabianMeiswinkel May 27, 2026
f3944d9
Renaming CosmosError
FabianMeiswinkel May 27, 2026
d8e0e76
Removing CosmosStatusKind
FabianMeiswinkel May 27, 2026
e512279
Changing thresholds
FabianMeiswinkel May 27, 2026
ce0d856
Fixing docs
FabianMeiswinkel May 27, 2026
635e874
Changing tests to compare against simple text
FabianMeiswinkel May 27, 2026
863e2a3
Made CosmosError Message static vs. Arc
FabianMeiswinkel May 27, 2026
04a58f7
Merge remote-tracking branch 'upstream/main' into users/fabianm/Respo…
FabianMeiswinkel May 27, 2026
d29f14f
Adding unique CosmosStatus for client-side errors.
FabianMeiswinkel May 27, 2026
874c2c7
Update README.md
FabianMeiswinkel May 27, 2026
9522175
Merge branch 'main' into users/fabianm/ResponseHeadersErrors
FabianMeiswinkel May 27, 2026
476d42e
Shortened Changelog entries
FabianMeiswinkel May 27, 2026
eb93e03
Update mod.rs
FabianMeiswinkel May 27, 2026
bf46439
Update response_headers.rs
FabianMeiswinkel May 27, 2026
e339d19
Update backtrace_capture.rs
FabianMeiswinkel May 27, 2026
d590ab5
Update mod.rs
FabianMeiswinkel May 27, 2026
ccbdeb1
Added tests
FabianMeiswinkel May 27, 2026
3e1fbee
Fix few NITs
FabianMeiswinkel May 27, 2026
5686efd
Switch SubStatusCode to u16
FabianMeiswinkel May 27, 2026
67330a4
Moving Backtrace env variable names into rust.rs
FabianMeiswinkel May 27, 2026
325d76f
Update backtrace.rs
FabianMeiswinkel May 27, 2026
9df0457
Moved helper into tests module
FabianMeiswinkel May 27, 2026
ed848a5
Update backtrace.rs
FabianMeiswinkel May 27, 2026
34a55ec
Update backtrace.rs
FabianMeiswinkel May 27, 2026
acff368
Making the backtrace config env not runtime scoped
FabianMeiswinkel May 27, 2026
9d5717c
Added substatuscode for offer without id
FabianMeiswinkel May 27, 2026
5ac5317
Fix throughput poller timeout CosmosStatus
FabianMeiswinkel May 27, 2026
9c45568
Fixing status codes
FabianMeiswinkel May 27, 2026
a216316
Added substatus code for continuation on non-query
FabianMeiswinkel May 27, 2026
9aa005b
Readme improvement
FabianMeiswinkel May 27, 2026
8e7fd90
Delete cosmos_status.rs
FabianMeiswinkel May 27, 2026
09f2314
Update cosmos_status.rs
FabianMeiswinkel May 27, 2026
8acc4ae
Merge remote-tracking branch 'upstream/main' into users/fabianm/Respo…
FabianMeiswinkel May 27, 2026
ee571d1
Build fixes
FabianMeiswinkel May 27, 2026
9c2b088
Fix test issue
FabianMeiswinkel May 27, 2026
bc4fa0a
Update backtrace.rs
FabianMeiswinkel May 27, 2026
8c9b71b
Removing CosmsoErrorBuilder from azure_data_cosmos
FabianMeiswinkel May 27, 2026
2cbd4b1
Fixes public API of sdk's CosmosError
FabianMeiswinkel May 27, 2026
4daeea1
Fixed public API of driver's CosmsoError
FabianMeiswinkel May 28, 2026
4d62f65
Fixes CosmsoError --> azure_core::Error conversion
FabianMeiswinkel May 28, 2026
334def8
Merge remote-tracking branch 'upstream/main' into users/fabianm/Respo…
FabianMeiswinkel May 28, 2026
4177082
Fixes azure_core::Error conversion
FabianMeiswinkel May 28, 2026
225bceb
Fixed dead duplicate CosmsoError::with_status usage
FabianMeiswinkel May 28, 2026
e08080b
walk the source chain to find inner backtrace
FabianMeiswinkel May 28, 2026
b5170b0
Reduce SAFE_CAPTURES_PER_SECOND to 1_000
FabianMeiswinkel May 28, 2026
5a9baea
Update backtrace.rs
FabianMeiswinkel May 28, 2026
e243f44
Doc fixes
FabianMeiswinkel May 28, 2026
bc45ea2
Update backtrace.rs
FabianMeiswinkel May 28, 2026
23159ce
Update mod.rs
FabianMeiswinkel May 28, 2026
01bd298
Merge branch 'main' into users/fabianm/ResponseHeadersErrors
FabianMeiswinkel May 28, 2026
be2b49f
Update http_client.rs
FabianMeiswinkel May 28, 2026
5c3421c
Merge branch 'users/fabianm/ResponseHeadersErrors' of https://github.…
FabianMeiswinkel May 28, 2026
e413869
Update http_client.rs
FabianMeiswinkel May 28, 2026
2b9d0ea
Fixes test failures
FabianMeiswinkel May 28, 2026
66866f7
Merge remote-tracking branch 'upstream/main' into users/fabianm/Respo…
FabianMeiswinkel May 28, 2026
15ef093
Merge upstream/main: resolve conflicts with Result/Error refactor
FabianMeiswinkel May 28, 2026
87537b0
Update lib.rs
FabianMeiswinkel May 28, 2026
5d88367
Fix few merge conflict updates manually
FabianMeiswinkel May 28, 2026
33ce7fd
Delete mcp.json
FabianMeiswinkel May 28, 2026
0d63e90
Addressed CR feedback
FabianMeiswinkel May 28, 2026
2d5e5f5
Skipping emulator vNext tests that don't work
FabianMeiswinkel May 28, 2026
62c5826
Disabling failing emulator vnext tests
FabianMeiswinkel May 28, 2026
3ab9f05
Merge remote-tracking branch 'upstream/main' into users/fabianm/Respo…
FabianMeiswinkel May 28, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ async-stream = { version = "0.3.6" }
async-trait = "0.1"
base64 = "0.22"
arc-swap = "1.7"
backtrace = "0.3"
bytes = "1.11.1"
cargo_metadata = "0.23.1"
clap = { version = "4.5.58", features = ["derive"] }
Expand Down
2 changes: 2 additions & 0 deletions sdk/cosmos/.cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"fabianm",
"failback",
"failovers",
"fanout",
"FILETIME",
"flamegraph",
"fmix",
Expand Down Expand Up @@ -154,6 +155,7 @@
"southindia",
"sproc",
"sprocs",
"stdlib",
"subsec",
"substatus",
"supportedcapabilities",
Expand Down
2 changes: 1 addition & 1 deletion sdk/cosmos/.github/skills/cosmos-design-struct/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ If a separate builder type is used, follow these conventions:
1. Name it `<Type>Builder`.
2. Keep builder fields private.
3. Provide `with_*` setters for optional fields.
4. Provide terminal `build(self, ...) -> <Type>` (or `azure_core::Result<Type>` when fallible).
4. Provide terminal `build(self, ...) -> <Type>` (or `crate::error::Result<Type>` / `azure_data_cosmos::Result<Type>` when fallible).
5. Keep required fields on `build(...)`, not as optional builder state.
6. Add `<Type>::builder(... required args ...) -> <Type>Builder` to initialize the builder type.

Expand Down
8 changes: 4 additions & 4 deletions sdk/cosmos/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ impl MyType {

// ✅ GOOD: Implement the standard trait
impl std::str::FromStr for MyType {
type Err = azure_core::Error;
type Err = azure_data_cosmos::Error;
fn from_str(s: &str) -> Result<Self, Self::Err> { /* ... */ }
}

Expand All @@ -66,7 +66,7 @@ If you need a non-fallible parse internally, create a **private** helper method

#### Error Handling

- Use `azure_core::Result<T>` for all fallible operations
- Use `azure_data_cosmos::Result<T>` (SDK) or `azure_data_cosmos_driver::error::Result<T>` (driver) for all fallible operations — both alias `Result<T, crate::Error>` over the typed Cosmos error.
- **Prefer returning `Result::Err` over panicking** in public methods whose inputs could originate from user-constructed types (even indirectly). Callers can then decide whether to propagate, log, or handle — rather than crashing their application. Use `assert!`/`panic!` only for true invariant violations that indicate programmer error in internal code.
- Cosmos-specific errors should provide:
- HTTP status code
Expand Down Expand Up @@ -190,7 +190,7 @@ pub async fn create_item<T: Serialize>(
&self,
item: &T,
options: &CreateItemOptions,
) -> azure_core::Result<ItemResponse<T>>
) -> azure_data_cosmos::Result<ItemResponse<T>>
where
T: for<'de> Deserialize<'de>,
{
Expand Down Expand Up @@ -355,7 +355,7 @@ pub mod builders {
endpoint: impl Into<String>,
credential: impl TokenCredential,
options: DriverOptions,
) -> azure_core::Result<Driver> {
) -> azure_data_cosmos_driver::error::Result<Driver> {
// ... construction logic
}
}
Expand Down
6 changes: 4 additions & 2 deletions sdk/cosmos/azure_data_cosmos/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

### Features Added

- Added `RegionStrategy::PreferredRegions` to allow specifying a fixed region preference order for failover, hedging, and retry. ([#4485](https://github.com/Azure/azure-sdk-for-rust/pull/4485))
- `CosmosError` can capture a stack backtrace on construction. Capture is opt-in (off by default; on when `RUST_BACKTRACE` is set or when explicit capacities are supplied) and protected against error storms by two configurable per-second limiters on the runtime builder. ([#4442](https://github.com/Azure/azure-sdk-for-rust/pull/4442))
- Introduced `azure_data_cosmos::CosmosError` and the crate-wide `azure_data_cosmos::Result<T>` alias, surfacing typed `CosmosStatus` (with predicate accessors like `is_not_found()` / `is_throttled()` / `is_transient()`), the originating `CosmosResponse`, and the operation `DiagnosticsContext` on every failure. `From<CosmosError> for azure_core::Error` is provided so callers using `?` against `azure_core::Error` continue to compose. ([#4442](https://github.com/Azure/azure-sdk-for-rust/pull/4442))
- Added `RoutingStrategy::PreferredRegions` to allow specifying a fixed region preference order for failover, hedging, and retry. ([#4485](https://github.com/Azure/azure-sdk-for-rust/pull/4485))
- Standardized every client-method options type with a public `operation: OperationOptions` field and `with_operation_options(OperationOptions) -> Self` setter, so any per-request `OperationOptions` setting can be configured via any options type. The following options types previously had no way to attach `OperationOptions` and now do: `ReadContainerOptions`, `ReadDatabaseOptions`, `ReplaceContainerOptions`, `CreateContainerOptions`, `CreateDatabaseOptions`, `DeleteContainerOptions`, `DeleteDatabaseOptions`, `QueryContainersOptions`, `QueryDatabasesOptions`, `ThroughputOptions`, `ReadFeedRangesOptions`. For `CreateContainerOptions` / `CreateDatabaseOptions` / `ReplaceContainerOptions`, the SDK still forces `content_response_on_write = Enabled` on the resolved options because control-plane mutations require the response body. `ReadFeedRangesOptions::operation` is currently inert (the underlying routing-map cache does not go through the operation pipeline) but is added for shape consistency with the other options types.
- Added `new()` constructors and `with_x` consuming setters to multi-required-field model types so callers can build them declaratively without struct-literal syntax (which is now blocked by `#[non_exhaustive]`): `VectorEmbedding::new(path, data_type, dimensions, distance_function)` + `with_path` / `with_data_type` / `with_dimensions` / `with_distance_function`; `ConflictResolutionPolicy::new(mode)` + `with_resolution_path` / `with_resolution_procedure`; `SpatialIndex::new(path)` + `with_type` (singular pusher onto `types`); `CompositeIndexProperty::new(path, order)` + `with_path` / `with_order`; `VectorIndex::new(path, index_type)` + `with_path` / `with_index_type`. These types do **not** implement `Default` — their constructors require values that have no meaningful default.
- Derived `Default` on `VectorEmbeddingPolicy`, `UniqueKeyPolicy`, `UniqueKey`, `PropertyPath`, and `CompositeIndex`, and added singular `with_x` pushers / setters: `VectorEmbeddingPolicy::with_embedding`, `UniqueKeyPolicy::with_unique_key`, `UniqueKey::with_path`, `PropertyPath::with_path`, and `CompositeIndex::with_property`. This matches the existing `IndexingPolicy::with_included_path` style and lets callers build these policies declaratively without constructing intermediate `Vec`s.
Expand All @@ -17,6 +19,7 @@

### Breaking Changes

- All fallible public APIs now return `azure_data_cosmos::Result<T>` (= `Result<T, CosmosError>`) instead of `azure_core::Result<T>`, and the error type was renamed `Error` → `CosmosError` (with `CosmosErrorBuilder` for construction). Categorization moved from a `Kind` enum to predicates on `CosmosStatus` (`is_not_found()`, `is_throttled()`, `is_transient()`, …); the underlying `azure_core::Error` is still reachable via `std::error::Error::source()`. ([#4442](https://github.com/Azure/azure-sdk-for-rust/pull/4442))
- Moved `QueryOptions::max_item_count` and `QueryOptions::continuation_token` into the new `QueryOptions::feed: FeedOptions` field. Callers that read or assign these fields directly should switch to `options.feed.max_item_count` / `options.feed.continuation_token`. The `with_max_item_count` / `with_continuation_token` convenience setters on `QueryOptions` continue to work unchanged.
- `ThroughputProperties` is now `#[non_exhaustive]` and no longer derives `Default`. The `Default` impl produced a meaningless wire payload (no manual throughput and no autoscale settings, which would send an empty offer body). Callers should use `ThroughputProperties::manual(throughput)` or `ThroughputProperties::autoscale(starting_maximum_throughput, increment_percent)` instead.
- Marked the following public model enums and response wrappers as `#[non_exhaustive]` to allow future variants/fields to be added without further breaking changes: `VectorDataType`, `VectorDistanceFunction`, `ConflictResolutionMode`, `IndexingMode`, `SpatialType`, `CompositeIndexOrder`, `VectorIndexType`, `BatchResponse`, `ItemResponse`, `ResourceResponse<T>`, `ResponseBody`, `ResponseHeaders`, `PartitionKeyVersion` and `CosmosStatus`. Callers must use `..` wildcard arms in `match`es over these enums and cannot construct these structs via struct-literal syntax (the SDK already provides constructors / setters for the constructable types).
Expand All @@ -43,7 +46,6 @@
- Removed `azure_data_cosmos::constants::SubStatusCode` and its `new`/`value`/`from_header_value`/`From`/`Display`/`Debug` API. The SDK no longer maintains a parallel sub-status-code type.
- The `User-Agent` header on every outgoing Cosmos DB request now identifies the wrapping SDK in addition to the driver. The new format is `azsdk-rust-cosmos/<sdk-version> azsdk-rust-cosmos-driver/<driver-version> <os>/<arch> rustc/<ver> [suffix]`, where `<sdk-version>` is this crate's version. This is wired automatically via the new `CosmosDriverRuntimeBuilder::with_wrapping_sdk_identifier` API in the driver, and lets telemetry distinguish callers using `azure_data_cosmos` from callers driving `azure_data_cosmos_driver` directly. No API surface in `azure_data_cosmos` changes. ([#4465](https://github.com/Azure/azure-sdk-for-rust/pull/4465))
- The `azure_data_cosmos::constants` module is no longer public. It only contained internal HTTP-header-name constants used by the SDK's own pipeline plumbing; nothing from it was intended for consumer use. The one previously-exposed public item (`SubStatusCode`) is re-exported from the crate root — see the bullet above.
>>>>>>> Conflict 1 of 1 ends

### Bugs Fixed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -933,10 +933,11 @@ ContainerConfig::new()

`with_partition_count` and `with_throughput` are infallible setters; all
validation happens in a single `build()` step that returns
`azure_core::Result<ContainerConfig>`. Use `build()?` inside a function
that returns `azure_core::Result<_>` (or `unwrap()` in tests).
`azure_data_cosmos_driver::error::Result<ContainerConfig>`. Use `build()?`
inside a function that returns a compatible `Result<_, _>` (or `unwrap()`
in tests).

Minimum provisioned throughput is 400 RU/s; values below this and a partition count of `0` are rejected with an `azure_core::Error` from `build()`.
Minimum provisioned throughput is 400 RU/s; values below this and a partition count of `0` are rejected with a `Client`-kind `azure_data_cosmos_driver::error::Error` from `build()`.

### Per-Partition Tracking

Expand Down
3 changes: 1 addition & 2 deletions sdk/cosmos/azure_data_cosmos/examples/cosmos/delete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

use std::error::Error;

use azure_core::http::StatusCode;
use azure_data_cosmos::CosmosClient;
use clap::{Args, Subcommand};

Expand Down Expand Up @@ -65,7 +64,7 @@ impl DeleteCommand {
.delete_item(partition_key, &item_id, None)
.await;
match response {
Err(e) if e.http_status() == Some(StatusCode::NotFound) => {
Err(e) if e.status().is_not_found() => {
println!("Item not found!")
}
Ok(_) => println!("Item deleted"),
Expand Down
3 changes: 1 addition & 2 deletions sdk/cosmos/azure_data_cosmos/examples/cosmos/read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

use std::error::Error;

use azure_core::http::StatusCode;
use azure_data_cosmos::CosmosClient;
use clap::{Args, Subcommand};

Expand Down Expand Up @@ -60,7 +59,7 @@ impl ReadCommand {
.read_item(&partition_key, &item_id, None)
.await;
match response {
Err(e) if e.http_status() == Some(StatusCode::NotFound) => {
Err(e) if e.status().is_not_found() => {
println!("Item not found!")
}
Ok(r) => {
Expand Down
3 changes: 1 addition & 2 deletions sdk/cosmos/azure_data_cosmos/examples/cosmos/replace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

use std::error::Error;

use azure_core::http::StatusCode;
use azure_data_cosmos::{
ContentResponseOnWrite, CosmosClient, ItemWriteOptions, OperationOptions, PartitionKey,
};
Expand Down Expand Up @@ -91,7 +90,7 @@ impl ReplaceCommand {
.replace_item(pk, &item_id, item, options)
.await;
match response {
Err(e) if e.http_status() == Some(StatusCode::NotFound) => {
Err(e) if e.status().is_not_found() => {
println!("Item not found!")
}
Ok(r) => {
Expand Down
8 changes: 6 additions & 2 deletions sdk/cosmos/azure_data_cosmos/src/account_endpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,15 @@ impl AccountEndpoint {
}

impl std::str::FromStr for AccountEndpoint {
type Err = azure_core::Error;
type Err = crate::CosmosError;

fn from_str(s: &str) -> Result<Self, Self::Err> {
let url: Url = s.parse().map_err(|e: url::ParseError| {
azure_core::Error::new(azure_core::error::ErrorKind::Other, e)
crate::DriverCosmosError::builder()
.with_status(crate::CosmosStatus::CLIENT_INVALID_ACCOUNT_ENDPOINT_URL)
.with_message("invalid account endpoint URL")
.with_arc_source(std::sync::Arc::new(e))
.build()
})?;
Ok(Self(url))
}
Expand Down
2 changes: 1 addition & 1 deletion sdk/cosmos/azure_data_cosmos/src/account_reference.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use std::sync::Arc;
///
/// This type bundles together the account endpoint and the credential needed to
/// authenticate with it. Use convenience constructors [`with_credential()`](Self::with_credential)
/// or [`with_authentication_key()`](Self::with_authentication_key) to create instances.
/// or [`with_authentication_key()`](Self::with_authentication_key) (requires the `key_auth` feature) to create instances.
///
/// # Examples
///
Expand Down
Loading
Loading