example from docs added as test
better error callbacks