moved onerror call to right position (diff got mixed up by git tool...)
propagate errors from server to client