Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def throw_warning(message, resp=None, cr=True):
"""
Recoverable Warning.
:param message: Message text
:param resp: Optional - CloudGenix SDK Response object
:param cr: Optional - Use (or not) Carriage Returns.
:return: None
"""
output = "WARNING: " + str(message)
if cr:
output += "\n"
sys.stderr.write(output)
if resp is not None:
output2 = str(jdout_detailed(resp))
if cr:
output2 += "\n"
sys.stderr.write(output2)
return
def throw_error(message, resp=None, cr=True):
"""
Non-recoverable error, write message to STDERR and exit or raise exception
:param message: Message text
:param resp: Optional - CloudGenix SDK Response object
:param cr: Optional - Use (or not) Carriage Returns.
:return: No Return, throws exception.
"""
output = "ERROR: " + str(message)
if cr:
output += "\n"
sys.stderr.write(output)
if resp is not None:
output2 = str(jdout_detailed(resp))
if cr:
output2 += "\n"
sys.stderr.write(output2)
raise CloudGenixConfigError(message)