Function kdb_c_api::error_to_string[][src]

pub fn error_to_string(error: K) -> K
Expand description

Convert an error object into usual K object which has the error string in the field s.

Example

use kdb_c_api::*;
 
extern "C" fn no_panick(func: K, args: K) -> K{
  let result=error_to_string(apply(func, args));
  if result.get_type() == qtype::ERROR{
    println!("FYI: {}", result.get_symbol().unwrap());
    // Decrement reference count of the error object which is no longer used.
    decrement_reference_count(result);
    KNULL
  }
  else{
    result
  }
}
q)chill: `libc_api_examples 2: (`no_panick; 2);
q)chill[$; ("J"; "42")]
success!
42
q)chill[+; (1; `a)]
FYI: type