Code Hell: JavaScript Error Messages


When you’re tasked to make changes to a legacy 3000+ line JavaScript file, seeing this at the start doesn’t inspire confidence:

// ErrorMessage
this._EventLocationControl_JS_NoClientDataHolder_ErrorMessage =
  config.EventLocationControl_JS_NoClientDataHolder_ErrorMessage;
this._EventLocationControl_JS_InvalidMileMarker_ErrorMessage =
  config.EventLocationControl_JS_InvalidMileMarker_ErrorMessage;
this._EventLocationControl_JS_NoDefaultMap_ErrorMessage =
  config.EventLocationControl_JS_NoDefaultMap_ErrorMessage;
this._EventLocationControl_JS_NoMMService_ErrorMessage1 =
  config.EventLocationControl_JS_NoMMService_ErrorMessage1;
this._EventLocationControl_JS_NoMMService_ErrorMessage2 =
  config.EventLocationControl_JS_NoMMService_ErrorMessage2;
this._EventLocationControl_JS_NoMMServiceRoadway_ErrorMessage =
  config.EventLocationControl_JS_NoMMServiceRoadway_ErrorMessage;
this._EventLocationControl_JS_LoadDirection_ErrorMessage =
  config.EventLocationControl_JS_LoadDirection_ErrorMessage;
this._EventLocationControl_JS_NoMMCrossStreet_ErrorMessage =
  config.EventLocationControl_JS_NoMMCrossStreet_ErrorMessage;
 
this._EventLocationControl_JS_NoMMService_ErrorMessage3 =
  config.EventLocationControl_JS_NoMMService_ErrorMessage3;
this._EventLocationControl_JS_NoMMService_ErrorMessage4 =
  config.EventLocationControl_JS_NoMMService_ErrorMessage4;
this._EventLocationControl_JS_NoMMService_ErrorMessage5 =
  config.EventLocationControl_JS_NoMMService_ErrorMessage5;
this._EventLocationControl_JS_NoMMService_ErrorMessage6 =
  config.EventLocationControl_JS_NoMMService_ErrorMessage6;
 
this._EventLocationControl_JS_PreviewMapInvalidStartEnd_ErrorMessage =
  config.EventLocationControl_JS_PreviewMapInvalidStartEnd_ErrorMessage;
this._EventLocationControl_JS_PreviewMapInvalidLocation_ErrorMessage =
  config.EventLocationControl_JS_PreviewMapInvalidLocation_ErrorMessage;
 
this._EventLocationControl_JS_City_Text =
  config.EventLocationControl_JS_City_Text;
this._EventLocationControl_JS_County_Text =
  config.EventLocationControl_JS_County_Text;
this._EventLocationControl_JS_District_Text =
  config.EventLocationControl_JS_District_Text;