Skip to main content

gsp_allocator/
error.rs

1// Copyright (C) Parity Technologies (UK) Ltd.
2// SPDX-License-Identifier: Apache-2.0
3
4// See `README.md` for the upstream source and license reference.
5
6/// The error type used by the allocators.
7#[derive(thiserror::Error, Debug, PartialEq)]
8pub enum Error {
9    /// Someone tried to allocate more memory than the allowed maximum per allocation.
10    #[error("Requested allocation size is too large")]
11    RequestedAllocationTooLarge,
12    /// Allocator run out of space.
13    #[error("Allocator ran out of space")]
14    AllocatorOutOfSpace,
15    /// The client passed a memory instance which is smaller than previously observed.
16    #[error("Shrinking of the underlying memory is observed")]
17    MemoryShrunk,
18    /// Some other error occurred.
19    #[error("Other: {0}")]
20    Other(&'static str),
21}