Add onerror

This one adds onerror callback