Skip to content

Commit

Permalink
Use better error message when interface check fails (fixes issue #74)
Browse files Browse the repository at this point in the history
  • Loading branch information
cmbruns committed Mar 28, 2020
1 parent 624700e commit 186ac82
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/translate/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,13 +286,18 @@ def __str__(self):
# Expose functions #
####################
def _checkInitError(error):
def _checkInterfaceVersion(version_key):
"""
Replace openvr error return code with a python exception
"""
if error != VRInitError_None:
shutdown()
raise OpenVRError("%s (error number %d)" % (getVRInitErrorAsSymbol(error), error))
if isInterfaceVersionValid(version_key):
return
shutdown()
error = VRInitError_Init_InterfaceNotFound
msg = f"The installed SteamVR runtime could not provide API version {version_key} requested by pyopenvr. "\\
f"You may need to update SteamVR or use an older version of pyopenvr. "\\
f"{getVRInitErrorAsSymbol(error)} (error number {error})."
raise OpenVRError(msg)
# Copying VR_Init inline implementation from https://github.com/ValveSoftware/openvr/blob/master/headers/openvr.h
Expand Down

0 comments on commit 186ac82

Please sign in to comment.