Liking cljdoc? Tell your friends :D

clj-ebpf.errors

Structured error handling for clj-ebpf.

Provides:

  • Typed exception hierarchy for BPF operations
  • Automatic retry for transient errors
  • Rich error context and diagnostics
Structured error handling for clj-ebpf.

Provides:
- Typed exception hierarchy for BPF operations
- Automatic retry for transient errors
- Rich error context and diagnostics
raw docstring

*max-retries*clj

Default maximum number of retries for transient errors

Default maximum number of retries for transient errors
sourceraw docstring

*retry-backoff-factor*clj

Multiplier for exponential backoff

Multiplier for exponential backoff
sourceraw docstring

*retry-delay-ms*clj

Default delay between retries in milliseconds

Default delay between retries in milliseconds
sourceraw docstring

arch-errorclj

(arch-error message data)

Create an architecture/platform error.

Create an architecture/platform error.
sourceraw docstring

assert-map-fdclj

(assert-map-fd fd context)

Assert that a map file descriptor is valid.

Assert that a map file descriptor is valid.
sourceraw docstring

assert-program-fdclj

(assert-program-fd fd context)

Assert that a program file descriptor is valid.

Assert that a program file descriptor is valid.
sourceraw docstring

attachment-errorclj

(attachment-error message data)

Create an attachment error.

Create an attachment error.
sourceraw docstring

bpf-errorclj

(bpf-error error-type message data)

Create a BPF exception with structured data.

Arguments:

  • error-type: One of the error-types keywords
  • message: Human-readable error message
  • data: Map of additional context

Returns an ExceptionInfo with :error-type key.

Create a BPF exception with structured data.

Arguments:
- error-type: One of the error-types keywords
- message: Human-readable error message
- data: Map of additional context

Returns an ExceptionInfo with :error-type key.
sourceraw docstring

check-resultclj

(check-result result operation get-errno-fn errno->kw-fn)

Check a syscall result and throw an appropriate error if negative.

Arguments:

  • result: The syscall result (typically an int or long)
  • operation: String describing the operation
  • get-errno-fn: Zero-arg function to get current errno
  • errno->kw-fn: Function to convert errno to keyword

Returns result if non-negative, throws otherwise.

Check a syscall result and throw an appropriate error if negative.

Arguments:
- result: The syscall result (typically an int or long)
- operation: String describing the operation
- get-errno-fn: Zero-arg function to get current errno
- errno->kw-fn: Function to convert errno to keyword

Returns result if non-negative, throws otherwise.
sourceraw docstring

classify-syscall-errorclj

(classify-syscall-error operation errno errno-kw)
(classify-syscall-error operation errno errno-kw additional-data)

Create a typed error from a syscall failure.

Arguments:

  • operation: String describing the operation (e.g., "map-create")
  • errno: The errno number
  • errno-kw: The errno keyword
  • additional-data: Optional additional context

Returns an ExceptionInfo with appropriate error type.

Create a typed error from a syscall failure.

Arguments:
- operation: String describing the operation (e.g., "map-create")
- errno: The errno number
- errno-kw: The errno keyword
- additional-data: Optional additional context

Returns an ExceptionInfo with appropriate error type.
sourceraw docstring

enhance-errorclj

(enhance-error e additional-data)

Enhance an exception with additional context.

Arguments:

  • e: The original exception
  • additional-data: Map of additional context to merge

Returns a new exception with merged data.

Enhance an exception with additional context.

Arguments:
- e: The original exception
- additional-data: Map of additional context to merge

Returns a new exception with merged data.
sourceraw docstring

errno->error-typeclj

(errno->error-type errno-kw)

Map an errno keyword to the most appropriate error type.

Map an errno keyword to the most appropriate error type.
sourceraw docstring

error-summaryclj

(error-summary e)

Get a one-line summary of an exception.

Get a one-line summary of an exception.
sourceraw docstring

error-typesclj

Hierarchy of BPF error types

Hierarchy of BPF error types
sourceraw docstring

format-errorclj

(format-error e)

Format an exception for display.

Returns a multi-line string with error details.

Format an exception for display.

Returns a multi-line string with error details.
sourceraw docstring

map-errorclj

(map-error message data)

Create a map operation error.

Create a map operation error.
sourceraw docstring

permission-errnosclj

Errno values that indicate permission issues

Errno values that indicate permission issues
sourceraw docstring

permission-errorclj

(permission-error message data)

Create a permission error.

Create a permission error.
sourceraw docstring

permission-error?clj

(permission-error? e)

Returns true if the exception represents a permission error.

Returns true if the exception represents a permission error.
sourceraw docstring

program-errorclj

(program-error message data)

Create a program operation error.

Create a program operation error.
sourceraw docstring

resource-errnosclj

Errno values that indicate resource exhaustion

Errno values that indicate resource exhaustion
sourceraw docstring

resource-errorclj

(resource-error message data)

Create a resource exhaustion error.

Create a resource exhaustion error.
sourceraw docstring

resource-error?clj

(resource-error? e)

Returns true if the exception represents a resource exhaustion error.

Returns true if the exception represents a resource exhaustion error.
sourceraw docstring

retryingcljmacro

(retrying opts & body)

Macro form of with-retry for more convenient usage.

Example: (retrying {:max-retries 5} (syscall/map-create ...))

Macro form of with-retry for more convenient usage.

Example:
(retrying {:max-retries 5}
  (syscall/map-create ...))
sourceraw docstring

syscall-errorclj

(syscall-error message data)

Create a syscall error.

Create a syscall error.
sourceraw docstring

transient-errnosclj

Errno values that indicate transient failures worth retrying

Errno values that indicate transient failures worth retrying
sourceraw docstring

transient-error?clj

(transient-error? e)

Returns true if the exception represents a transient error worth retrying.

Returns true if the exception represents a transient error worth retrying.
sourceraw docstring

verifier-errorclj

(verifier-error message data)

Create a verifier rejection error.

Create a verifier rejection error.
sourceraw docstring

verifier-error?clj

(verifier-error? e)

Returns true if the exception is a BPF verifier rejection.

Returns true if the exception is a BPF verifier rejection.
sourceraw docstring

with-retryclj

(with-retry f)
(with-retry f
            {:keys [max-retries delay-ms backoff-factor on-retry]
             :or {max-retries *max-retries*
                  delay-ms *retry-delay-ms*
                  backoff-factor *retry-backoff-factor*
                  on-retry (fn [_ _ _] nil)}})

Execute a function with automatic retry on transient errors.

Arguments:

  • f: Zero-argument function to execute
  • opts: Optional map with:
    • :max-retries (default 3)
    • :delay-ms (default 100)
    • :backoff-factor (default 2.0)
    • :on-retry (fn [attempt delay-ms exception] ...) - callback on retry

Returns the result of f, or throws after max retries.

Execute a function with automatic retry on transient errors.

Arguments:
- f: Zero-argument function to execute
- opts: Optional map with:
  - :max-retries (default 3)
  - :delay-ms (default 100)
  - :backoff-factor (default 2.0)
  - :on-retry (fn [attempt delay-ms exception] ...) - callback on retry

Returns the result of f, or throws after max retries.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close