Ausnahmen
Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Hinweis: Entwicklern von neuen Anwendungen wird dringend empfohlen, die NDB-Clientbibliothek zu verwenden. Diese bietet im Vergleich zur vorliegenden Clientbibliothek verschiedene Vorteile, z. B. das automatische Caching von Entitäten über die Memcache API. Wenn Sie derzeit die ältere DB-Clientbibliothek verwenden, finden Sie weitere Informationen im Leitfaden zur Migration von DB- zu NDB-Clientbibliotheken.
Das google.appengine.ext.db
-Paket bietet folgende Ausnahmeklassen:
- exception Error()
-
Dies ist die Basisklasse für alle Ausnahmen in diesem Paket.
- exception BadArgumentError()
- Einer Abfragemethode wurde ein fehlerhaftes Argument übergeben.
- exception BadFilterError()
- Ein Filterstring in der Abfrage ist ungültig.
- exception BadKeyError()
- Der angegebene Schlüsselstring ist kein gültiger Schlüssel.
- exception BadPropertyError()
- Das Attribut konnte nicht erstellt werden, da sein Name kein String ist.
- exception BadQueryError()
- Der Abfragestring ist keine gültige Abfrage.
- exception BadRequestError()
- Die Anfrage an den Datenspeicherdienst hat mindestens ein ungültiges Attribut. Dies ist der Fall, wenn eine abgeleitete Klasse von Model einige Methoden (z. B. kind()) mit einer falschen Implementierung überschreibt.
- exception BadValueError()
- Dem Attribut konnte kein Wert zugewiesen werden, da der Wert für den Attributtyp ungültig ist.
- exception ConfigurationError()
- Ein Attribut ist nicht ordnungsgemäß konfiguriert.
- exception DuplicatePropertyError()
- Eine Modelldefinition enthält mehrere Attribute mit dem gleichen Namen.
- exception InternalError()
- Beim Datenspeicherdienst ist ein interner Fehler aufgetreten. Diese Ausnahme bedeutet nicht unbedingt, dass der Vorgang fehlgeschlagen ist.
- exception KindError()
- In der Anwendung wurde versucht, eine Datenentität mit einer Modellklasse zu verwenden, die nicht mit der Entität übereinstimmt.
- exception NeedIndexError()
- Wird ausgelöst, wenn das SDK keinen übereinstimmenden Index für eine Abfrage findet, die einen solchen Index erfordert. Prüfen Sie die Verwaltungskonsole zur Verwaltung der Indexe und der Datei index.yaml.
- exception NotSavedError()
- Es wurde eine Aktion durchgeführt, für die das Objekt im Datenspeicher gespeichert worden sein muss (put-Vorgang). Dies ist jedoch nicht der Fall.
- exception PropertyError()
- Das Modellattribut, auf das verwiesen wird, ist im Datenobjekt nicht vorhanden.
- exception ReferencePropertyResolveError()
- Das Modell, auf das ein ReferenceProperty-Attribut verweist, ist nicht vorhanden. Siehe Referenzen.
- exception ReservedWordError()
- In einem Modell wird ein Attribut mit einem unzulässigen Namen definiert. Siehe Nicht zulässige Attributnamen.
- exception Rollback()
- Zeigt an, dass eine Funktion in einer Transaktion versucht, ein Rollback der Transaktion anstelle eines Commits auszuführen. Jegliche nicht erfasste Ausnahme in einer Transaktion führt zu einem Rollback der Transaktion. Diese Ausnahmeklasse dient zur Nutzerfreundlichkeit, wenn eine Funktion ein Rollback durchführen möchte und keine andere Ausnahme gilt.
- exception Timeout()
- Wird ausgegeben, wenn ein Datenspeichervorgang die maximale Dauer für Datenspeichervorgänge überschreitet. Diese Ausnahme bedeutet nicht unbedingt, dass der Vorgang fehlgeschlagen ist.
- exception TransactionFailedError()
- Die Transaktion oder der Datenspeichervorgang konnte auch nach einem erneuten Versuch nicht per Commit ausgeführt werden. Das wird üblicherweise durch eine hohe Konfliktrate verursacht: Die Daten werden von vielen anderen Anwendungsinstanzen gleichzeitig aktualisiert und diese Instanz konnte das Commit ihrer Transaktion nicht innerhalb einer festgelegten Anzahl von Versuchen durchführen. Siehe Transaktionen.
Das google.appengine.runtime.apiproxy_errors
-Paket bietet folgende Ausnahmeklassen:
- exception CapabilityDisabledError()
-
Zeigt an, dass ein Datastore API-Aufruf nicht ausgeführt wurde, da diese spezielle Datenspeicherfunktion nicht verfügbar ist.
Sofern nicht anders angegeben, sind die Inhalte dieser Seite unter der Creative Commons Attribution 4.0 License und Codebeispiele unter der Apache 2.0 License lizenziert. Weitere Informationen finden Sie in den Websiterichtlinien von Google Developers. Java ist eine eingetragene Marke von Oracle und/oder seinen Partnern.
Zuletzt aktualisiert: 2025-09-04 (UTC).
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-09-04 (UTC)."],[[["\u003cp\u003eDevelopers are highly recommended to utilize the NDB Client Library for new applications due to its enhanced features like automatic entity caching.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003egoogle.appengine.ext.db\u003c/code\u003e package offers a range of exception classes to handle various errors related to datastore operations, including issues with arguments, filters, keys, properties, and queries.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003egoogle.appengine.runtime.apiproxy_errors\u003c/code\u003e package includes the \u003ccode\u003eCapabilityDisabledError\u003c/code\u003e exception, which signals when a specific datastore functionality is not accessible.\u003c/p\u003e\n"],["\u003cp\u003eSeveral exceptions in \u003ccode\u003egoogle.appengine.ext.db\u003c/code\u003e highlight potential issues in model definition and data consistency, such as \u003ccode\u003eDuplicatePropertyError\u003c/code\u003e, \u003ccode\u003eKindError\u003c/code\u003e, \u003ccode\u003ePropertyError\u003c/code\u003e, \u003ccode\u003eReferencePropertyResolveError\u003c/code\u003e, and \u003ccode\u003eReservedWordError\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe package provides specific error handling for transaction-related issues with classes like \u003ccode\u003eRollback\u003c/code\u003e, and \u003ccode\u003eTransactionFailedError\u003c/code\u003e to help in situations where a transaction needs to be rolled back, or a transaction could not be committed.\u003c/p\u003e\n"]]],[],null,["# Exceptions\n\n**Note:**\nDevelopers building new applications are **strongly encouraged** to use the\n[NDB Client Library](/appengine/docs/legacy/standard/python/ndb), which has several benefits\ncompared to this client library, such as automatic entity caching via the Memcache\nAPI. If you are currently using the older DB Client Library, read the\n[DB to NDB Migration Guide](/appengine/docs/legacy/standard/python/ndb/db_to_ndb)\n\nThe `google.appengine.ext.db` package provides the following exception classes:\n\nexception Error()\n\n: This is the base class for all exceptions in this package.\n\nexception BadArgumentError()\n: A bad argument was given to a query method.\n\nexception BadFilterError()\n: A filter string in the query is invalid.\n\nexception BadKeyError()\n: The provided key string is not a valid key.\n\nexception BadPropertyError()\n: The property could not be created because its name is not a string.\n\nexception BadQueryError()\n: The query string is not a valid query.\n\nexception BadRequestError()\n: The request to the datastore service has one or more invalid properties. This is possible if a subclass of [Model](/appengine/docs/legacy/standard/python/datastore/modelclass) overrides some methods (such as [kind()](/appengine/docs/legacy/standard/python/datastore/modelclass#Model_kind)) with an incorrect implementation.\n\nexception BadValueError()\n: The property could not be assigned a value because the value is invalid for the property type.\n\nexception ConfigurationError()\n: A property is not configured correctly.\n\nexception DuplicatePropertyError()\n: A model definition has more than one property with the same name.\n\nexception InternalError()\n: There was an error internal to the datastore service. This exception does not necessarily mean that the operation failed.\n\nexception KindError()\n: The application attempted to use a data entity with a model class that does not match the entity.\n\nexception NeedIndexError()\n: Raised when the SDK does not find a matching index for a query that requires one. Check the [Administration Console](/appengine/docs/adminconsole) to manage your indexes and your [index.yaml](/appengine/docs/legacy/standard/python/config/indexconfig#creating_datastore_indexes) file.\n\nexception NotSavedError()\n: An action was performed that requires the object to have been saved (put) to the datastore, but the object is not saved.\n\nexception PropertyError()\n: The referenced model property does not exist on the data object.\n\nexception ReferencePropertyResolveError()\n: The model referenced by a [ReferenceProperty](/appengine/docs/legacy/standard/python/datastore/typesandpropertyclasses#ReferenceProperty) does not exist. See [References](/appengine/docs/legacy/standard/python/datastore/datamodeling#References).\n\nexception ReservedWordError()\n: A model defines a property whose name is disallowed. See [Disallowed Property Names](/appengine/docs/legacy/standard/python/datastore/modelclass#Disallowed_Property_Names).\n\nexception Rollback()\n: Indicates that a function in a transaction wants to roll back the transaction instead of committing it. Any uncaught exception in a transaction will cause the transaction to roll back. This exception class is for convenience, when a function wants to roll back and no other exception applies.\n\nexception Timeout()\n: Raised when the datastore operation exceeds the maximum amount of time allowed for datastore operations. This exception does not necessarily mean that the operation failed.\n\nexception TransactionFailedError()\n: The transaction or datastore operation could not be committed, even after retrying. This is usually caused by a high rate of contention: The data is being updated by many other application instances simultaneously, and this instance could not commit its transaction within a fixed number of retries. See [Transactions](/appengine/docs/legacy/standard/python/datastore/transactions).\n\nThe `google.appengine.runtime.apiproxy_errors` package provides the following exception classes:\n\nexception CapabilityDisabledError()\n\n: Indicates that a datastore api call was not performed as that particular datastore functionality is not available."]]