Skip to content

Commit

Permalink
✨ feat: 新增插件服务端渲染错误
Browse files Browse the repository at this point in the history
  • Loading branch information
arvinxx committed Aug 28, 2023
1 parent a3e0579 commit ad4f107
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ export const PluginErrorType = {
PluginMetaInvalid: 'PluginMetaInvalid', // 插件元数据无效

PluginManifestNotFound: 'PluginManifestNotFound', // 插件描述文件不存在
PluginManifestInvalid: 'PluginManifestInvalid', // 插件描述文件不存在
PluginManifestInvalid: 'PluginManifestInvalid', // 插件描述文件格式不正确

PluginSettingsInvalid: 'PluginSettingsInvalid', // 插件设置不正确

PluginApiNotFound: 'PluginApiNotFound', // 插件 API 不存在
PluginApiParamsError: 'PluginApiParamsError', // 插件 API 请求入参有问题

PluginServerError: 'PluginServerError', // 插件服务端出错

// ******* 客户端错误 ******* //
BadRequest: 400,
Unauthorized: 401,
Expand All @@ -41,17 +43,16 @@ const getStatus = (errorType: IPluginErrorType | string) => {
return 404;

case PluginErrorType.PluginMetaInvalid:
return 490;
case PluginErrorType.PluginMarketIndexInvalid:
case PluginErrorType.PluginManifestInvalid:
return 491;
case PluginErrorType.PluginApiParamsError:
return 492;
return 490;

case PluginErrorType.PluginMarketIndexNotFound:
return 590;

case PluginErrorType.PluginMarketIndexInvalid:
return 590;
case PluginErrorType.PluginApiParamsError:
case PluginErrorType.PluginSettingsInvalid:
return 422;
}

if (typeof errorType === 'number') return errorType;
Expand Down

0 comments on commit ad4f107

Please sign in to comment.