Commit Graph

4 Commits

Author SHA1 Message Date
Vincent Young
9d6b294a61
fix(service): log translation errors and hide internals from clients
Return a generic "Translation failed" message instead of echoing
err.Error() in the HTTP response, and log the underlying error
server-side via log.Printf. Avoids leaking internal details (proxy
address, upstream URL, etc.) to API clients while keeping the 500
behavior introduced in #224.
2026-06-02 14:38:02 +08:00
Bonny Lin
d19a3902df
fix(service): validate request body on /translate and /v1/translate (#225)
The two handlers ignored the error from c.BindJSON, so a malformed JSON body was silently processed as an empty payload. Check the error and return 400, consistent with /v2/translate.
2026-06-02 14:32:22 +08:00
Bonny Lin
3f099d187c
fix(service): return 500 instead of crashing on translation error (#224)
The /translate, /v1/translate and /v2/translate handlers called log.Fatalf when TranslateByDeepLX returned an error. log.Fatalf calls os.Exit, so a single failed translation would tear down the whole server process. Return a 500 JSON response and keep serving instead.
2026-05-31 03:47:09 -07:00
Jason Lyu
0a9ff6b582
refactor: make service exportable (#183) 2025-04-08 13:53:20 -04:00