Improve js error messages to handle no message field