ebpf/
error.rs

1// Copyright 2024 The Fuchsia Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#[derive(thiserror::Error, Debug, PartialEq, Eq)]
6pub enum EbpfError {
7    #[error("Unable to create VM")]
8    VmInitialization,
9
10    #[error("VM error registering callback: {0}")]
11    VmRegisterError(String),
12
13    #[error("Verification error loading program: {0}")]
14    ProgramVerifyError(String),
15
16    #[error("Failed to link program: {0}")]
17    ProgramLinkError(String),
18
19    #[error("VM error loading program: {0}")]
20    VmLoadError(String),
21
22    #[error("Invalid cBPF instruction code: 0x{0:x}")]
23    InvalidCbpfInstruction(u16),
24
25    #[error("Invalid cBPF scratch memory offset: 0x{0:x}")]
26    InvalidCbpfScratchOffset(u32),
27
28    #[error("Invalid cBPF jump offset: 0x{0:x}")]
29    InvalidCbpfJumpOffset(u32),
30}