Skip to main content

register_error_handler

Function register_error_handler 

Source
pub fn register_error_handler(cb_value: Callback)
Expand description

Register user provided error handler

ยงExamples

#[macro_use]
extern crate arrayfire;

use arrayfire::{AfError, Callback, info, register_error_handler};
use std::error::Error;

fn handle_error(error_code: AfError) {
    match error_code {
        AfError::SUCCESS => {}, /* No-op */
        _ => panic!("Error message: {}", error_code),
    }
}

fn main() {
    //Registering the error handler should be the first call
    //before any other functions are called if your version
    //of error is to be used for subsequent function calls
    register_error_handler(Callback::new(handle_error));

    info();
}