unierror.uts 589 字节
Newer Older
DCloud-yyl's avatar
DCloud-yyl 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
import {ConnectSocketFail ,ConnectSocketErrorCode} from "./interface.uts"

/**
 * 错误主题
 */
export const UniErrorSubject = 'uni-websocket';
/**
 * 错误码
 * @UniError
 */
export const UniErrors : Map<ConnectSocketErrorCode, string> = new Map([
	/**
	 * URL 格式不合法
	 */
	[600009, 'invalid URL'],
]);


export class ConnectSocketFailImpl extends UniError implements ConnectSocketFail {
	constructor(errCode : ConnectSocketErrorCode) {
		super();
		this.errSubject = UniErrorSubject;
		this.errCode = errCode;
		this.errMsg = UniErrors[errCode] ?? ""
	}
}