blob: 609d9e5d5a839f6cf70eaa4b0aa4580be3feaf21 [file] [log] [blame]
# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Custom exceeptions for ChromeOS Gestures command line interface.
This code is modeled after and derived from the Command class in
class CrosGesturesException(StandardError):
"""Exception raised when a problem is encountered running a gsutil command.
This exception should be used to signal user errors or system failures
(like timeouts), not bugs (like an incorrect param value). For the
latter you should raise Exception so we can see where/how it happened
via gsutil -D (which will include a stack trace for raised Exceptions).
def __init__(self, reason, informational=False):
"""Instantiate a CrosGesturesException.
reason: text describing the problem.
informational: indicates reason should be printed as FYI, not a failure.
self.reason = reason
self.informational = informational
def __repr__(self):
return 'CrosGesturesException: %s' % self.reason
def __str__(self):
return 'CrosGesturesException: %s' % self.reason