Function arrayfire::register_error_handler [] [src]

pub fn register_error_handler(cb_value: Callback<'static>)

Register user provided error handler

Examples

#[macro_use]
extern crate arrayfire;

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

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

pub const ERR_HANDLE: Callback<'static> = Callback{ cb: &handleError};

fn main() {
    register_error_handler(ERR_HANDLE);

    info();
}