unierror.uts 1.1 KB
Newer Older
DCloud-yyl's avatar
DCloud-yyl 已提交
1 2
import { FileSystemManagerErrorCode,IFileSystemManagerFail } from "./interface.uts"

DCloud-yyl's avatar
DCloud-yyl 已提交
3 4 5
/**
 * 错误主题
 */
DCloud-yyl's avatar
DCloud-yyl 已提交
6
export const FileSystemManagerUniErrorSubject = 'uni-fileSystemManager';
DCloud-yyl's avatar
DCloud-yyl 已提交
7 8 9 10 11

/**
 * 错误码
 * @UniError
 */
DCloud-yyl's avatar
DCloud-yyl 已提交
12
export const FileSystemManagerUniErrors : Map<FileSystemManagerErrorCode, string> = new Map([
DCloud-yyl's avatar
DCloud-yyl 已提交
13 14 15 16 17 18 19 20 21 22 23

	[1200002, 'type error. only support base64 / utf-8'],
	[1300002, 'no such file or directory'],
	[1300013, 'permission denied'],
	[1300021, 'Is a directory'],
	[1300022, 'Invalid argument'],
	[1300066, 'directory not empty'],
	[1301003, 'illegal operation on a directory'],
	[1301005, 'file already exists'],
	[1300201, 'system error'],
	[1300202, 'the maximum size of the file storage limit is exceeded'],
DCloud-yyl's avatar
DCloud-yyl 已提交
24 25 26
	[1301111, 'brotli decompress fail'],
	[1302003, 'invalid flag'],
	[1300009, 'bad file descriptor']
DCloud-yyl's avatar
DCloud-yyl 已提交
27
]);
DCloud-yyl's avatar
DCloud-yyl 已提交
28 29 30 31 32 33 34 35
export class FileSystemManagerFailImpl extends UniError implements IFileSystemManagerFail {
	constructor(errCode : FileSystemManagerErrorCode) {
		super();
		this.errSubject = FileSystemManagerUniErrorSubject;
		this.errCode = errCode;
		this.errMsg = FileSystemManagerUniErrors.get(errCode) ?? "";
	}
}