Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ go_deps.bzl @dfinity/idx
/packages/ic-dummy-getrandom-for-wasm/ @dfinity/crypto-team
/packages/ic-ed25519/ @dfinity/crypto-team
/packages/ic-ethereum-types/ @dfinity/cross-chain-team
/packages/ic-deterministic-heap-bytes/ @dfinity/execution
/packages/ic-deterministic-heap-bytes-derive/ @dfinity/execution
/packages/ic-heap-bytes/ @dfinity/execution
/packages/ic-heap-bytes-derive/ @dfinity/execution
/packages/ic-hpke/ @dfinity/crypto-team
/packages/ic-http-types/ @dfinity/cross-chain-team
/packages/ic-metrics-assert/ @dfinity/cross-chain-team
Expand Down
49 changes: 30 additions & 19 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
members = [
"packages/canlog",
"packages/canlog_derive",
"packages/ic-deterministic-heap-bytes",
"packages/ic-deterministic-heap-bytes-derive",
"packages/ic-dummy-getrandom-for-wasm",
"packages/ic-ed25519",
"packages/ic-error-types",
"packages/ic-ethereum-types",
"packages/ic-heap-bytes",
"packages/ic-heap-bytes-derive",
"packages/ic-hpke",
"packages/ic-http-types",
"packages/ic-ledger-hash-of",
Expand Down
25 changes: 10 additions & 15 deletions packages/ic-error-types/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,22 @@ load("@rules_rust//rust:defs.bzl", "rust_library", "rust_test")

package(default_visibility = ["//visibility:public"])

DEPENDENCIES = [
# Keep sorted.
"@crate_index//:serde",
"@crate_index//:strum",
]

MACRO_DEPENDENCIES = [
"@crate_index//:strum_macros",
]

rust_library(
name = "ic-error-types",
srcs = glob(["src/**"]),
proc_macro_deps = MACRO_DEPENDENCIES,
proc_macro_deps = [
"@crate_index//:strum_macros",
],
version = "0.2.0",
deps = DEPENDENCIES,
deps = [
# Keep sorted.
"//packages/ic-heap-bytes",
"@crate_index//:serde",
"@crate_index//:strum",
],
)

rust_test(
name = "ic-error-types-tests",
srcs = glob(["src/**/*.rs"]),
proc_macro_deps = MACRO_DEPENDENCIES,
deps = DEPENDENCIES,
crate = ":ic-error-types",
)
1 change: 1 addition & 0 deletions packages/ic-error-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ authors.workspace = true
edition.workspace = true

[dependencies]
ic-heap-bytes = { path = "../ic-heap-bytes" }
serde = { workspace = true }
strum = { workspace = true }
strum_macros = { workspace = true }
27 changes: 25 additions & 2 deletions packages/ic-error-types/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//! A crate that groups user-facing and internal error types and codes produced
//! by the Internet Computer.

use ic_heap_bytes::DeterministicHeapBytes;
use serde::{Deserialize, Serialize};
use std::{convert::TryFrom, fmt};
use str_traits::StrEllipsize;
Expand Down Expand Up @@ -141,7 +142,18 @@ impl From<ErrorCode> for RejectCode {
/// code and the rest is just a sequentially assigned two-digit
/// number.
#[derive(
Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Deserialize, EnumIter, Serialize,
Copy,
Clone,
Eq,
DeterministicHeapBytes,
PartialEq,
Ord,
PartialOrd,
Hash,
Debug,
Deserialize,
EnumIter,
Serialize,
)]
pub enum ErrorCode {
// 1xx -- `RejectCode::SysFatal`
Expand Down Expand Up @@ -217,7 +229,18 @@ const MAX_USER_ERROR_DESCRIPTION_LEN_BYTES: usize = 8 * 1024;
/// The error that is sent back to users of IC if something goes
/// wrong. It's designed to be copyable and serializable so that we
/// can persist it in ingress history.
#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Deserialize, Serialize)]
#[derive(
Clone,
Eq,
DeterministicHeapBytes,
PartialEq,
Ord,
PartialOrd,
Hash,
Debug,
Deserialize,
Serialize,
)]
pub struct UserError {
code: ErrorCode,
description: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ load("@rules_rust//rust:defs.bzl", "rust_proc_macro")
package(default_visibility = ["//visibility:public"])

rust_proc_macro(
name = "ic-deterministic-heap-bytes-derive",
name = "ic-heap-bytes-derive",
srcs = glob(["src/**"]),
version = "0.1.0",
deps = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ authors.workspace = true
description.workspace = true
documentation.workspace = true
edition.workspace = true
name = "ic-deterministic-heap-bytes-derive"
name = "ic-heap-bytes-derive"
version.workspace = true

[lib]
Expand Down
Loading
Loading