rust-ext/src/exceptions.rs
raw| 1 | // Copyright (c) 2020-present, Gregory Szorc |
| 2 | // All rights reserved. |
| 3 | // |
| 4 | // This software may be modified and distributed under the terms |
| 5 | // of the BSD license. See the LICENSE file for details. |
| 6 | |
| 7 | use pyo3::{create_exception, exceptions::PyException, prelude::*}; |
| 8 | |
| 9 | create_exception!(module, ZstdError, PyException); |
| 10 | |
| 11 | pub(crate) fn init_module(py: Python, module: &Bound<'_, PyModule>) -> PyResult<()> { |
| 12 | module.add("ZstdError", py.get_type::<ZstdError>())?; |
| 13 | |
| 14 | Ok(()) |
| 15 | } |