JS: fixed error callback to be in sync with Java