1.9.30 sync.
[gae.git] / python / google / appengine / api / appinfo_errors.py
blob1ad1a42854c82abe6fdcbaaa3e502e9571e6240f
1 #!/usr/bin/env python
3 # Copyright 2007 Google Inc.
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
22 """Errors used in the Python appinfo API, used by app developers."""
34 class Error(Exception):
35 """Base datastore AppInfo type."""
38 class EmptyConfigurationFile(Error):
39 """Tried to load empty configuration file"""
42 class MultipleConfigurationFile(Error):
43 """Tried to load configuration file with multiple AppInfo objects"""
46 class UnknownHandlerType(Error):
47 """Raised when it is not possible to determine URL mapping type."""
50 class UnexpectedHandlerAttribute(Error):
51 """Raised when a handler type has an attribute that it does not use."""
54 class MissingHandlerAttribute(Error):
55 """Raised when a handler is missing an attribute required by its type."""
58 class MissingURLMapping(Error):
59 """Raised when there are no URL mappings in external appinfo."""
62 class TooManyURLMappings(Error):
63 """Raised when there are too many URL mappings in external appinfo."""
66 class PositionUsedInAppYamlHandler(Error):
67 """Raised when position attribute is used in handler in AppInfoExternal."""
70 class InvalidBuiltinFormat(Error):
71 """Raised when the name of the builtin in a list item cannot be identified."""
74 class MultipleBuiltinsSpecified(Error):
75 """Raised when more than one builtin is specified in a single list element."""
78 class DuplicateBuiltinsSpecified(Error):
79 """Raised when a builtin is specified more than once in the same file."""
82 class BackendNotFound(Error):
83 """Raised when a Backend is required but not specified."""
86 class DuplicateBackend(Error):
87 """Raised when a backend is found more than once in 'backends'."""
90 class MissingApiConfig(Error):
91 """Raised if an api_endpoint handler is configured but no api_config."""
94 class RuntimeDoesNotSupportLibraries(Error):
95 """Raised when 'libraries' is used in a runtime that does not support it."""
98 class DuplicateLibrary(Error):
99 """Raised when a library is found more than once in 'libraries'."""
102 class InvalidLibraryVersion(Error):
103 """Raised when a library uses a version that isn't supported."""
106 class InvalidLibraryName(Error):
107 """Raised when a library is specified that isn't supported."""
110 class ThreadsafeWithCgiHandler(Error):
111 """Raised when threadsafe is enabled with a CGI handler specified."""
114 class MissingThreadsafe(Error):
115 """Raised when the runtime needs a threadsafe declaration and it's missing."""
118 class InvalidHttpHeaderName(Error):
119 """Raised when an invalid HTTP header name is used.
121 This issue arrises what a static handler uses http_headers. For example, the
122 following would not be allowed:
124 handlers:
125 - url: /static
126 static_dir: static
127 http_headers:
128 D@nger: Will Robinson
132 class InvalidHttpHeaderValue(Error):
133 """Raised when an invalid HTTP header value is used.
135 This issue arrises what a static handler uses http_headers. For example, the
136 following would not be allowed:
138 handlers:
139 - url: /static
140 static_dir: static
141 http_headers:
142 Some-Unicode: "\u2628"
146 class ContentTypeSpecifiedMultipleTimes(Error):
147 """Raised when mime_type and http_headers specify a mime type.
149 N.B. This will be raised even when both fields specify the same content type.
150 E.g. the following configuration (snippet) will be rejected:
152 handlers:
153 - url: /static
154 static_dir: static
155 mime_type: text/html
156 http_headers:
157 content-type: text/html
159 This only applies to static handlers i.e. a handler that specifies static_dir
160 or static_files.
164 class TooManyHttpHeaders(Error):
165 """Raised when a handler specified too many HTTP headers.
167 The message should indicate the maximum number of headers allowed.
171 class TooManyScalingSettingsError(Error):
172 """Raised when more than one scaling settings section is present."""