Unify function signatures

This patchset changes all async functions to call their callbacks with an error first and the data (if any) second.

This change also handles more situations in which there are potential errors.