File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ For reading the price you just need to call `query_price_feed` function within y
14
14
You can find the contract address and price feed ids in the section [ Contracts and Price Feeds] ( #contracts-and-price-feeds ) below.
15
15
16
16
``` rust
17
- let price_feed : PriceFeed = query_price_feed (deps . querier, contract_addr , id ). unwrap () . price_feed;
17
+ let price_feed : PriceFeed = query_price_feed (deps . querier, contract_addr , id )? . price_feed;
18
18
```
19
19
20
20
The ` PriceFeed ` struct contains several useful functions for working with the price.
@@ -27,7 +27,7 @@ For more detailed information, please see the crate documentation.
27
27
Read the current price from a ` PriceFeed ` :
28
28
29
29
``` rust
30
- let current_price : Price = price_feed . get_current_price (). unwrap () ;
30
+ let current_price : Price = price_feed . get_current_price (). ok_or ( StdError :: not_found ( " Current Price is not available " )) ? ;
31
31
println! (" price: ({} +- {}) x 10^{}" , current_price . price, current_price . conf, current_price . expo);
32
32
```
33
33
You can’t perform that action at this time.
0 commit comments