fix: add error for not published

This commit is contained in:
GareArc
2025-06-09 19:35:56 +09:00
parent 0c01f7498d
commit 07c39d7b92
2 changed files with 10 additions and 5 deletions

View File

@@ -1,12 +1,11 @@
from flask import request
from flask_restful import Resource, marshal_with, reqparse # type: ignore
from controllers.common import fields
from controllers.common import helpers as controller_helpers
from controllers.web import api
from controllers.web.error import AppUnavailableError
from controllers.web.error import AppNotPublishedError, AppUnavailableError
from controllers.web.wraps import WebApiResource
from flask import request
from flask_restful import Resource, marshal_with, reqparse # type: ignore
from libs.passport import PassportService
from models.model import App, AppMode
from services.app_service import AppService
@@ -31,7 +30,7 @@ class AppParameterApi(WebApiResource):
else:
app_model_config = app_model.app_model_config
if app_model_config is None:
raise AppUnavailableError()
raise AppNotPublishedError()
features_dict = app_model_config.to_dict()

View File

@@ -7,6 +7,12 @@ class AppUnavailableError(BaseHTTPException):
code = 400
class AppNotPublishedError(BaseHTTPException):
error_code = "app_not_published"
description = "App not published, please check your app configurations."
code = 400
class NotCompletionAppError(BaseHTTPException):
error_code = "not_completion_app"
description = "Please check if your Completion app mode matches the right API route."