Skip to content

Commit

Permalink
Merge pull request #67 from billdodd/fix/catch-exc
Browse files Browse the repository at this point in the history
Add exception handling in RisMonolith_v1_0_0._load()
  • Loading branch information
mraineri authored Oct 10, 2019
2 parents 27ba173 + e8e7312 commit 45d3867
Showing 1 changed file with 27 additions and 21 deletions.
48 changes: 27 additions & 21 deletions src/redfish/ris/ris.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,33 +369,39 @@ def _load(
if "/Logs/" in path:
return

# TODO: need to find a better way to support non ascii characters
path = path.replace("|", "%7C")
# catch any exceptions during URL parsing or GET requests
try:
# remove fragments
newpath = urlparse(path)
newpath = list(newpath[:])
newpath[-1] = ""

# remove fragments
newpath = urlparse(path)
newpath = list(newpath[:])
newpath[-1] = ""
path = urlunparse(tuple(newpath))

path = urlunparse(tuple(newpath))
LOGGER.debug("_loading %s", path)

LOGGER.debug("_loading %s", path)
if not self.reload:
if path.lower() in self._visited_urls:
return

if not self.reload:
if path.lower() in self._visited_urls:
return

resp = self._client.get(path)

if resp.status != 200:
path = path + "/"
resp = self._client.get(path)

if resp.status == 401:
raise SessionExpiredRis("Invalid session. Please logout and "
"log back in or include credentials.")
elif resp.status != 200:
return
if resp.status != 200:
path = path + "/"
resp = self._client.get(path)

if resp.status == 401:
raise SessionExpiredRis("Invalid session. Please logout and "
"log back in or include credentials.")
elif resp.status != 200:
return
except SessionExpiredRis:
raise
except Exception as e:
cause = e.__cause__ if e.__cause__ else e
LOGGER.error("Resource '{}' skipped due to exception: {}"
.format(path, repr(cause)))
return

self.queue.put((resp, path, skipinit, self))

Expand Down

0 comments on commit 45d3867

Please sign in to comment.