typed_store/rocks/
errors.rs

1// Copyright (c) Mysten Labs, Inc.
2// Modifications Copyright (c) 2024 IOTA Stiftung
3// SPDX-License-Identifier: Apache-2.0
4
5use rocksdb::Error as RocksError;
6use typed_store_error::TypedStoreError;
7
8pub fn typed_store_err_from_bincode_err(err: bincode::Error) -> TypedStoreError {
9    TypedStoreError::Serialization(format!("{err}"))
10}
11
12pub fn typed_store_err_from_bcs_err(err: bcs::Error) -> TypedStoreError {
13    TypedStoreError::Serialization(format!("{err}"))
14}
15
16pub fn typed_store_err_from_rocks_err(err: RocksError) -> TypedStoreError {
17    TypedStoreError::RocksDB(format!("{err}"))
18}