Unify fallback and unimplemented API error handling
- Add a shared common error response schema and unknown error code for business-level fallbacks - Return business error payloads for router NoRoute and NoMethod fallbacks - Align the existing event list fallback response with the shared error structure - Introduce an explicit unimplemented API error type instead of relying on formatted strings - Make /api batch dispatch return per-item status 600 error entries for unimplemented modules and actions without failing the whole batch Signed-off-by: Sean Du <do4suki@gmail.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
package subscenario
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
honokautils "honoka-chan/internal/utils"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
@@ -11,7 +11,7 @@ func SubscenarioApi(ctx *gin.Context, action string) (res any, err error) {
|
||||
case "subscenarioStatus":
|
||||
res, err = subscenarioStatus(ctx)
|
||||
default:
|
||||
err = fmt.Errorf("unimplemented action: subscenario: %s", action)
|
||||
err = honokautils.NewUnimplementedActionError("subscenario", action)
|
||||
}
|
||||
return res, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user