[][src]Function tskit_rust::error::panic_on_tskit_error

pub fn panic_on_tskit_error(code: i32)

Takes the return code from a tskit function and panics if the code indicates an error. The error message is included in the panic statement.

Examples:

let rv = 0;  // All good!
tskit_rust::error::panic_on_tskit_error(rv);
let rv = 1;  // Probably something like a new node id.
tskit_rust::error::panic_on_tskit_error(rv);

This will panic:

This example panics
let rv = -202; // "Node out of bounds error"
tskit_rust::error::panic_on_tskit_error(rv);