Obsolete: This interface was removed from the specification and was replaced by usage of DOMException .

IndexedDB API IDBDatabaseException object represents exception conditions that can be encountered while performing database operations.

属性

属性 类型 描述
code unsigned short The most appropriate error code for the condition.
message DOMString Error message describing the exception raised.

常量

注意: Do not rely on the numeric values of the constants, which might change as the specifications continue to change. Use the constant names instead.
常量 描述
ABORT_ERR 8 A request was aborted, for example, through a call to IDBTransaction.abort .
CONSTRAINT_ERR 4 A mutation operation in the transaction failed because a constraint was not satisfied. For example, an object, such as an object store or index, already exists and a request attempted to create a new one.
DATA_ERR 5 Data provided to an operation does not meet requirements.
NON_TRANSIENT_ERR 2 An operation was not allowed on an object. Unless the cause of the error is corrected, retrying the same operation would result in failure.
NOT_ALLOWED_ERR 6

An operation was called on an object where it is not allowed or at a time when it is not allowed. It also occurs if a request is made on a source object that has been deleted or removed.

More specific variants of this error includes: TRANSACTION_INACTIVE_ERR and READ_ONLY_ERR .

NOT_FOUND_ERR 3 The operation failed because the requested database object could not be found; for example, an object store did not exist but was being opened.
QUOTA_ERR 11 Either there's not enough remaining storage space or the storage quota was reached and the user declined to give more space to the database.
READ_ONLY_ERR 9 A mutation operation was attempted in a READ_ONLY transaction.
TIMEOUT_ERR 10 A lock for the transaction could not be obtained in a reasonable time.
TRANSACTION_INACTIVE_ERR 7 A request was made against a transaction that is either not currently active or is already finished.
UNKNOWN_ERR 1 The operation failed for reasons unrelated to the database itself, and it is not covered by any other error code--for example, a failure due to disk IO errors.
VER_ERR 12 A request to open a database with a version lower than the one it already has. This can only happen with IDBOpenDBRequest .

浏览器兼容性

The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. 更新 GitHub 上的兼容性数据
桌面 移动
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
IDBDatabaseException 弃用 非标 Chrome 12 Prefixed
12 Prefixed
Prefixed Implemented with the vendor prefix: webkit
Edge ≤79 Prefixed
≤79 Prefixed
Prefixed Implemented with the vendor prefix: webkit
Firefox 4 — 14 IE No Opera No Safari No WebView Android No Chrome Android No Firefox Android 4 — 14 Opera Android No Safari iOS No Samsung Internet Android No

图例

完整支持

完整支持

不支持

不支持

非标。预期跨浏览器支持较差。

非标。预期跨浏览器支持较差。

弃用。不要用于新网站。

弃用。不要用于新网站。

要求使用供应商前缀或不同名称。

要求使用供应商前缀或不同名称。

元数据

  • 最后修改:
  1. IndexedDB API
  2. IDBDatabaseException
  3. IndexedDB 相关页面
    1. IDBCursor
    2. IDBCursorSync
    3. IDBCursorWithValue
    4. IDBDatabase
    5. IDBDatabaseSync
    6. IDBEnvironment
    7. IDBEnvironmentSync
    8. IDBFactory
    9. IDBFactorySync
    10. IDBIndex
    11. IDBIndexSync
    12. IDBKeyRange
    13. IDBObjectStore
    14. IDBObjectStoreSync
    15. IDBOpenDBRequest
    16. IDBRequest
    17. IDBTransaction
    18. IDBTransactionSync
    19. IDBVersionChangeEvent
    20. IDBVersionChangeRequest

版权所有  © 2014-2026 乐数软件    

工业和信息化部: 粤ICP备14079481号-1