MCPcopy Index your code
hub / github.com/scriptscat/scriptcat / verify

Method verify

packages/filesystem/s3/s3.ts:113–142  ·  view source on GitHub ↗

* 验证 Bucket 访问权限和凭证 * @throws {WarpTokenError} 认证失败 * @throws {Error} Bucket 不存在或网络错误

()

Source from the content-addressed store, hash-verified

111 * @throws {Error} Bucket 不存在或网络错误
112 */
113 async verify(): Promise<void> {
114 try {
115 await this.client.request("HEAD", this.bucket);
116 } catch (error: any) {
117 if (error instanceof S3Error) {
118 if (error.code === "NotFound" || error.code === "NoSuchBucket" || error.statusCode === 404) {
119 throw new Error("NotFound");
120 }
121 if (
122 error.code === "InvalidAccessKeyId" ||
123 error.code === "SignatureDoesNotMatch" ||
124 error.code === "InvalidClientTokenId"
125 ) {
126 throw new WarpTokenError(error);
127 }
128 if (
129 error.code === "AccessDenied" ||
130 error.code === "PermanentRedirect" ||
131 error.statusCode === 403 ||
132 error.statusCode === 301
133 ) {
134 throw new Error("Access Denied");
135 }
136 }
137 if (error.message?.includes("getaddrinfo") || error.message?.includes("fetch failed")) {
138 throw new Error("Network connection failed. Please check your internet connection.");
139 }
140 throw error;
141 }
142 }
143
144 /**
145 * 打开文件用于读取

Callers

nothing calls this directly

Calls 1

requestMethod · 0.45

Tested by

no test coverage detected