Files
deb-python-dcos/dcos/api/errors.py
José Armando García Sancio b2e9527e93 DCOS-422 Implement event emitter
We need this to eventually be able to colorize the output for JSON
TOML, etc. Change all references of print to emitter.publish. We also
removed the subcommand command.

Need to do a `make clean env` after this change.
2015-02-17 06:37:54 +00:00

30 lines
557 B
Python

import abc
class Error(object):
"""Abstract class for describing errors."""
@abc.abstractmethod
def error(self):
"""Creates an error message
:returns: The error message
:rtype: str
"""
raise NotImplementedError
class DefaultError(Error):
"""Construct a basic Error class based on a string
:param message: String to use for the error message
:type message: str
"""
def __init__(self, message):
self._message = message
def error(self):
return self._message