fix: add error for not published

fix/app-not-published-error
GareArc 12 months ago
parent 0c01f7498d
commit 07c39d7b92
No known key found for this signature in database

@ -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 fields
from controllers.common import helpers as controller_helpers from controllers.common import helpers as controller_helpers
from controllers.web import api 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 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 libs.passport import PassportService
from models.model import App, AppMode from models.model import App, AppMode
from services.app_service import AppService from services.app_service import AppService
@ -31,7 +30,7 @@ class AppParameterApi(WebApiResource):
else: else:
app_model_config = app_model.app_model_config app_model_config = app_model.app_model_config
if app_model_config is None: if app_model_config is None:
raise AppUnavailableError() raise AppNotPublishedError()
features_dict = app_model_config.to_dict() features_dict = app_model_config.to_dict()

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

Loading…
Cancel
Save