diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2021-06-01 01:36:53 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2021-06-02 16:57:07 +0200 |
commit | 76148b27f7501bac061992136852be4303370c8d (patch) | |
tree | fc0559253e833c9252fa14ebaec5321d88bfb4e8 /server/controllers/api/custom-page.ts | |
parent | 5ed25fb76e920dac364cb9ef46f14ec4bd372949 (diff) | |
download | PeerTube-76148b27f7501bac061992136852be4303370c8d.tar.gz PeerTube-76148b27f7501bac061992136852be4303370c8d.tar.zst PeerTube-76148b27f7501bac061992136852be4303370c8d.zip |
refactor API errors to standard error format
Diffstat (limited to 'server/controllers/api/custom-page.ts')
-rw-r--r-- | server/controllers/api/custom-page.ts | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/server/controllers/api/custom-page.ts b/server/controllers/api/custom-page.ts index 3c47f7b9a..c19f03c56 100644 --- a/server/controllers/api/custom-page.ts +++ b/server/controllers/api/custom-page.ts | |||
@@ -27,7 +27,12 @@ export { | |||
27 | 27 | ||
28 | async function getInstanceHomepage (req: express.Request, res: express.Response) { | 28 | async function getInstanceHomepage (req: express.Request, res: express.Response) { |
29 | const page = await ActorCustomPageModel.loadInstanceHomepage() | 29 | const page = await ActorCustomPageModel.loadInstanceHomepage() |
30 | if (!page) return res.sendStatus(HttpStatusCode.NOT_FOUND_404) | 30 | if (!page) { |
31 | return res.fail({ | ||
32 | status: HttpStatusCode.NOT_FOUND_404, | ||
33 | message: 'Instance homepage could not be found' | ||
34 | }) | ||
35 | } | ||
31 | 36 | ||
32 | return res.json(page.toFormattedJSON()) | 37 | return res.json(page.toFormattedJSON()) |
33 | } | 38 | } |
@@ -38,5 +43,5 @@ async function updateInstanceHomepage (req: express.Request, res: express.Respon | |||
38 | await ActorCustomPageModel.updateInstanceHomepage(content) | 43 | await ActorCustomPageModel.updateInstanceHomepage(content) |
39 | ServerConfigManager.Instance.updateHomepageState(content) | 44 | ServerConfigManager.Instance.updateHomepageState(content) |
40 | 45 | ||
41 | return res.sendStatus(HttpStatusCode.NO_CONTENT_204) | 46 | return res.status(HttpStatusCode.NO_CONTENT_204).end() |
42 | } | 47 | } |