Skip to main content
Version: 2.x

API Reference > @next-core/brick-kit > httpErrorToString

httpErrorToString() function

将 http 请求错误转换为可读的字符串。

Signature:

export declare function httpErrorToString(
error: Error | HttpFetchError | HttpResponseError | HttpParseError | Event
): string;

Parameters

ParameterTypeDescription
errorError | HttpFetchError | HttpResponseError | HttpParseError | Event错误对象。

Returns:

string

转换为字符串的错误信息。

Remarks

将依次尝试读取返回的 JSON 格式数据的字符串类型的 errormsg 字段,如果没有找到则返回 error.toString() 的结果。