Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Error Handling

Rob Parham edited this pageOct 29, 2017 ·8 revisions

jSQL will throwjSQL_Error exceptions for various errors. You can catch them with atry..catch or you can implement a function to be called when an exception is called.


jSQL.onError(funct)

Register a function to be called before jSQL throws any exception. This function will be passed thejSQL_Error that will be thrown.

Parameters
  • funct - A function to be called before anyjSQL_Error is thrown.
Example
jSQL.onError(function(e){    alert(e.message);});

jSQL_Error Exception Class

jSQL only throws instances of thejSQL_Error Exception class, which has three properties:

  • jSQL_Error.error - Theerror number (or undefined)
  • jSQL_Error.stack - The stack trace of the Exception (for debugging purposes)
  • jSQL_Error.message - The message associated with the given error code

jSQL_Lexer_Error andjSQL_Parse_Error inherit from the generaljSQL_Error.


Error Codes

Error#Error Message
0001Corrupted function stored in data.
0003Invalid datatype definition.
0004DataType must have atype property.
0005DataType must have aserialize function.
0006DataType must have anunserialize function.
0007Unsupported data type.
0010Invalid constraint.
0011This table already has a primary key.
0012renameColumn expects and old column name and a new one, both must be strings.
0013Column does not exist.
0014Data must be an array.
0015Data not structured properly.
0016Cannot insert a null value in a primary column.
0017Primary Key violated.
0018Cannot insert a null value in a unique column.
0019Unique key violated.
0020Data type's serialize() method did not return a string.
0021Table does not exist.
0022Method does not apply to query type.
0023Fetch expects paramter one to be 'ASSOC', 'ARRAY', or undefined.
0024Expected number or quoted string.
0025Expected 'ORDER BY'.
0026Must call ORDER BY before using ASC.
0027Must call ORDER BY before using DESC.
0028Unintelligible query. Expected 'FROM'.
0029Unintelligible query. Expected 'TABLE'.
0030Unintelligible query. Expected 'INTO'.
0031Unintelligible query. Expected 'VALUES'.
0032Unintelligible query. Too many values.
0033Unintelligible query. Columns mismatch.
0034Invalid Column definition.
0035Unintelligible query. Expected 'NOT'.
0036Unintelligible query. Expected 'EXISTS'.
0037Unintelligible query. expected ')'.
0038Invalid Arg definition.
0039Unintelligible query. Expected 'SET'.
0040Unintelligible query. Expected 'FROM'.
0041Unintelligible query. WTF?
0042Must add a conditional before adding another 'Where' condition.
0043Column name must be a string.
0044Must add a 'where' clause before the 'equals' call.
0045Must add a 'where' clause before the 'preparedLike' call.
0046Must add a 'where' clause before the 'doesNotEqual' call.
0047Must add a 'where' clause before the 'lessThan' call.
0048Must add a 'where' clause before the 'greaterThan' call.
0049Must add a 'where' clause before the 'contains' call.
0050Must add a 'where' clause before the 'endsWith' call.
0051Must add a 'where' clause before the 'beginsWith' call.
0052Must use orderBy clause before using ASC.
0053Must use orderBy clause before using DESC.
0054Could not execute query.
0055Error creating table.
0056Error opening database.
0057indexedDB is not supported in this browser.
0058Could not add data after 10 seconds.
0059Error updating datastore version.
0060Could not connect to the indexedDB datastore.
0061Could not initiate a transaction.
0062Could not initiate a request.
0063Browser doesn't support Web SQL or IndexedDB.
0064Unable to write to datastore file.
0065AUTO_INCREMENT column must be a key.
0066AUTO_INCREMENT column must be an INT type.
0067API is out of memory, cannot store more data.
0068Invalid ENUM value.
0069NUMERIC or INT type invalid or out of range.
undefinedUnknown error.

Persistence Management

Storage APIs

Querying the Database

jSQLTable class

jSQLQuery interface

jSQLWhereClause class

jSQL Helper Methods

jSQL Syntax

Fun with DataTypes

Error Handling

Examples

License

Clone this wiki locally

[8]ページ先頭

©2009-2025 Movatter.jp