openshift / origin-web-common

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can we make _urlForResource stop throwing runtime errors for resources that dont exist

jwforres opened this issue · comments

DataService get and list could both deal with a null/undefined/"" URL coming back by resolving its promise as an error.

But watch doesn't have a way to resolve something as error today, so if a watch failed on this issue there is nothing it can do to alert the controller.

Related to all the test noise?

DEBUG [phantomjs.launcher]: [OpenShift] _urlForResource called with unknown resource bogus/v1 [object Arguments]
DEBUG [phantomjs.launcher]:   :0 in apply
DEBUG [phantomjs.launcher]: [OpenShift] _urlForResource called with unknown resource pod/v1 [object Arguments]
  :0 in apply
DEBUG [phantomjs.launcher]: [OpenShift] _urlForResource called with unknown resource user/v1 [object Arguments]
  :0 in apply
  :0 in apply
[OpenShift] _urlForResource called with unknown resource clusterroles/unknown [object Arguments]
  :0 in apply
[OpenShift] _urlForResource called with unknown resource nodes/v1beta3 [object Arguments]
  :0 in apply
[OpenShift] _urlForResource called with unknown resource nodes/unknown [object Arguments]

This stuff is a little annoying as well.

that comes from spec tests where we are validating that urlForResource does what we expect in the presence of unknown resources. So its expected currently. but yes we would still like to change how this behaves in general.

Ah, right its in DataService:

  DataService.prototype._urlForResource = function(resource, name, context, isWebsocket, params) {
    var apiInfo = APIService.apiInfo(resource);
    if (!apiInfo) {
      Logger.error("_urlForResource called with unknown resource", resource, arguments);
      return null;
    }

not the test. hmm.

Fixed by #304
/close