Enrich external API failure audit metadata
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
import { parseApiErrorMessage } from '../../packages/shared/src/http';
|
||||
import {
|
||||
appendApiErrorRequestId,
|
||||
parseApiErrorMessage,
|
||||
} from '../../packages/shared/src/http';
|
||||
import {
|
||||
ApiClientError,
|
||||
BACKGROUND_AUTH_REQUEST_OPTIONS,
|
||||
@@ -338,7 +341,12 @@ export async function readAssetBytes(
|
||||
if (!response.ok) {
|
||||
const message = await response
|
||||
.text()
|
||||
.then((text) => parseApiErrorMessage(text, '读取资源内容失败'))
|
||||
.then((text) =>
|
||||
appendApiErrorRequestId(
|
||||
parseApiErrorMessage(text, '读取资源内容失败'),
|
||||
response.headers.get('x-request-id'),
|
||||
),
|
||||
)
|
||||
.catch(() => '');
|
||||
throw new Error(message || '读取资源内容失败');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user