javascript: fixed error code and message