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_error(message, resp=None, cr=True, exception=CloudGenixAPIError):
"""
Non-recoverable error, write message to STDERR and raise exception
**Parameters:**
- **message:** Message text
- **resp:** Optional - CloudGenix SDK Response object
- **cr:** Optional - Use (or not) Carriage Returns.
- **exception:** Optional - Custom Exception to throw, otherwise uses `CloudGenixAPIError`
**Returns:** No Return, throws exception.
"""
output = "ERROR: " + str(message)
if cr:
output += "\n"
sys.stderr.write(output)