add `err` argument to onRequestEnd()