added onError()
consistent naming of generic type arguments.