Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1087)

Unified Diff: tools/grit/grit/exception.py

Issue 1410853008: Move grit from DEPS into src. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: webview licenses Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/grit/grit/constants.py ('k') | tools/grit/grit/extern/BogoFP.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/grit/grit/exception.py
diff --git a/tools/grit/grit/exception.py b/tools/grit/grit/exception.py
new file mode 100755
index 0000000000000000000000000000000000000000..a9584a0e05036bd8674d6c1758e071348b535e3f
--- /dev/null
+++ b/tools/grit/grit/exception.py
@@ -0,0 +1,138 @@
+#!/usr/bin/env python
+# Copyright (c) 2012 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+'''Exception types for GRIT.
+'''
+
+class Base(Exception):
+ '''A base exception that uses the class's docstring in addition to any
+ user-provided message as the body of the Base.
+ '''
+ def __init__(self, msg=''):
+ if len(msg):
+ if self.__doc__:
+ msg = self.__doc__ + ': ' + msg
+ else:
+ msg = self.__doc__
+ super(Base, self).__init__(msg)
+
+
+class Parsing(Base):
+ '''An error occurred parsing a GRD or XTB file.'''
+ pass
+
+
+class UnknownElement(Parsing):
+ '''An unknown node type was encountered.'''
+ pass
+
+
+class MissingElement(Parsing):
+ '''An expected element was missing.'''
+ pass
+
+
+class UnexpectedChild(Parsing):
+ '''An unexpected child element was encountered (on a leaf node).'''
+ pass
+
+
+class UnexpectedAttribute(Parsing):
+ '''The attribute was not expected'''
+ pass
+
+
+class UnexpectedContent(Parsing):
+ '''This element should not have content'''
+ pass
+
+
+class MissingMandatoryAttribute(Parsing):
+ '''This element is missing a mandatory attribute'''
+ pass
+
+
+class MutuallyExclusiveMandatoryAttribute(Parsing):
+ '''This element has 2 mutually exclusive mandatory attributes'''
+ pass
+
+
+class DuplicateKey(Parsing):
+ '''A duplicate key attribute was found.'''
+ pass
+
+
+class TooManyExamples(Parsing):
+ '''Only one <ex> element is allowed for each <ph> element.'''
+ pass
+
+
+class GotPathExpectedFilenameOnly(Parsing):
+ '''The 'filename' attribute of <output> and the 'file' attribute of <part>
+ must be bare filenames, not paths.
+ '''
+ pass
+
+
+class FileNotFound(Parsing):
+ '''The resource file was not found.
+ '''
+ pass
+
+
+class InvalidMessage(Base):
+ '''The specified message failed validation.'''
+ pass
+
+
+class InvalidTranslation(Base):
+ '''Attempt to add an invalid translation to a clique.'''
+ pass
+
+
+class NoSuchTranslation(Base):
+ '''Requested translation not available'''
+ pass
+
+
+class NotReady(Base):
+ '''Attempt to use an object before it is ready, or attempt to translate
+ an empty document.'''
+ pass
+
+
+class TooManyPlaceholders(Base):
+ '''Too many placeholders for elements of the same type.'''
+ pass
+
+
+class MismatchingPlaceholders(Base):
+ '''Placeholders do not match.'''
+ pass
+
+
+class InvalidPlaceholderName(Base):
+ '''Placeholder name can only contain A-Z, a-z, 0-9 and underscore.'''
+ pass
+
+
+class BlockTagInTranslateableChunk(Base):
+ '''A block tag was encountered where it wasn't expected.'''
+ pass
+
+
+class SectionNotFound(Base):
+ '''The section you requested was not found in the RC file. Make
+sure the section ID is correct (matches the section's ID in the RC file).
+Also note that you may need to specify the RC file's encoding (using the
+encoding="" attribute) if it is not in the default Windows-1252 encoding.
+ '''
+ pass
+
+
+class IdRangeOverlap(Base):
+ '''ID range overlap.'''
+ pass
+
« no previous file with comments | « tools/grit/grit/constants.py ('k') | tools/grit/grit/extern/BogoFP.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698