we still need to pass the onerror callback here I think, and it should be covered by a test :)