add API reference
add exception for wrapping error rather than just exit