65 lines
1.3 KiB
Plaintext
65 lines
1.3 KiB
Plaintext
import { ICreateSQLiteContextError } from "./interface.uts"
|
|
|
|
/**
|
|
* 错误主题
|
|
*/
|
|
export const UniErrorSubject = 'uni-create-sql-context';
|
|
|
|
/**
|
|
* 错误码
|
|
* @UniError
|
|
*/
|
|
export const UniErrors: Map<number, string> = new Map([
|
|
/**
|
|
* 数据库启动失败
|
|
*/
|
|
[1000001, 'Database startup failed'],
|
|
/**
|
|
* 执行SQL增删改语句失败
|
|
*/
|
|
[1000002, 'Failed to execute SQL insert, update, delete statement'],
|
|
/**
|
|
* 执行SQL查询语句失败
|
|
*/
|
|
[1000003, 'Failed to execute SQL query statement'],
|
|
/**
|
|
* 事务开始失败
|
|
*/
|
|
[1000004, 'Transaction start failed'],
|
|
/**
|
|
* 事务提交失败
|
|
*/
|
|
[1000005, 'Transaction commit failed'],
|
|
/**
|
|
* 事务回滚失败
|
|
*/
|
|
[1000006, 'Transaction rollback failed'],
|
|
/**
|
|
* 数据库关闭失败
|
|
*/
|
|
[1000007, 'Database shutdown failed'],
|
|
/**
|
|
* 未知错误
|
|
*/
|
|
[1000008, 'Unknown error'],
|
|
]);
|
|
|
|
export class createSQLiteContextFailImpl extends UniError {
|
|
override errCode: number;
|
|
override errSubject: string;
|
|
override cause?: UTSError | null;
|
|
override errMsg: string;
|
|
|
|
constructor(
|
|
errCode: number,
|
|
errMsg: string = '',
|
|
errSubject: string = '',
|
|
cause?: UTSError | null
|
|
) {
|
|
super();
|
|
this.errCode = errCode;
|
|
this.errMsg = errMsg;
|
|
this.errSubject = errSubject;
|
|
this.cause = cause ?? null;
|
|
}
|
|
} |