Errors, Warnings & Logging
Overview
- Every major module throws DeepboxError subclasses such as ShapeError, InvalidParameterError, NotFittedError, and ConvergenceError.
- Warnings can be routed, filtered, or captured programmatically, which is useful for notebooks, tests, and app-level telemetry.
- Logger hooks give you a lightweight tracing surface without introducing runtime dependencies.
BroadcastError
Error thrown when tensor shapes cannot be broadcast together.
ConvergenceError
Error thrown when an iterative algorithm fails to converge within the maximum allowed iterations.
DataValidationError
Error thrown when data validation fails.
DeepboxError
Base class for all Deepbox-specific errors.
DeviceError
Error thrown when an operation is requested on an unsupported or unavailable compute device.
DTypeError
Error thrown when a requested dtype is unsupported or cannot be handled by the current implementation.
IndexError
Error thrown when an invalid index is used to access tensor elements.
InvalidParameterError
Error thrown when invalid parameters are passed to a function or method.
MemoryError
Error thrown when memory allocation fails or memory limits are exceeded.
NotFittedError
Error thrown when a model or estimator is used before being fitted.
NotImplementedError
Error thrown when a method or code path exists in the public API but is not implemented yet.
ShapeError
Error thrown when tensor shapes are incompatible or invalid.
Logger
Lightweight logger for Deepbox models and utilities.
Get the current global log handler (undefined = console.log default).
Set a global log handler for all Logger instances.
Get warnings captured by a collector.
Add a warning filter.
Remove all warning filters.
Set a custom warning handler (replaces console.warn).
Issue a warning.
import { Logger, ShapeError, catchWarnings, warn,} from "deepbox/core";const logger = new Logger(1, "docs");logger.info("Deepbox runtime ready");const warnings = catchWarnings(() => { warn("This is a routed Deepbox warning", "UserWarning", "docs");});console.log(warnings);console.log(new ShapeError("mismatched shapes"));