- 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>
17 lines
345 B
Go
17 lines
345 B
Go
package honokautils
|
|
|
|
import (
|
|
"encoding/json"
|
|
"honoka-chan/pkg/utils"
|
|
"path/filepath"
|
|
)
|
|
|
|
const serverDataPath = "assets/serverdata"
|
|
|
|
func LoadServerData[T any](fileName string) (T, error) {
|
|
var data T
|
|
filePath := filepath.Join(serverDataPath, fileName)
|
|
err := json.Unmarshal([]byte(utils.ReadAllText(filePath)), &data)
|
|
return data, err
|
|
}
|