add error-fn to call when errors occur, 0.4.6-alpha