API Reference > @next-core/brick-kit > httpErrorToString
httpErrorToString() function
将 http 请求错误转换为可读的字符串。
Signature:
export declare function httpErrorToString(
error: Error | HttpFetchError | HttpResponseError | HttpParseError | Event
): string;
Parameters
| Parameter | Type | Description |
|---|---|---|
| error | Error | HttpFetchError | HttpResponseError | HttpParseError | Event | 错误对象。 |
Returns:
string
转换为字符串的错误信息。
Remarks
将依次尝试读取返回的 JSON 格式数据的字符串类型的 error 和 msg 字段,如果没有找到则返回 error.toString() 的结果。