Skip to content

Commit

Permalink
✨ feat: export error type
Browse files Browse the repository at this point in the history
  • Loading branch information
arvinxx committed Dec 13, 2023
1 parent 5b5455e commit 6e31c87
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const PluginErrorType = {

export type IPluginErrorType = (typeof PluginErrorType)[keyof typeof PluginErrorType];

const getStatus = (errorType: IPluginErrorType | string) => {
export const getPluginErrorStatus = (errorType: IPluginErrorType | string) => {
switch (errorType) {
case PluginErrorType.PluginApiNotFound:
case PluginErrorType.PluginMetaNotFound:
Expand Down Expand Up @@ -79,7 +79,7 @@ export const createErrorResponse = (
body?: string | object,
): Response => {
// 获取错误类型对应的状态码
const statusCode = getStatus(errorType);
const statusCode = getPluginErrorStatus(errorType);

// 构造错误响应数据
const data: ErrorResponse = { body, errorType };
Expand Down

0 comments on commit 6e31c87

Please sign in to comment.