Skip to content

Commit 5f1c1b6

Browse files
authored
Merge pull request #146 from PretendoNetwork/dev
fix: Actually log server errors on API
2 parents 1208f48 + ae6e6af commit 5f1c1b6

6 files changed

Lines changed: 16 additions & 6 deletions

File tree

apps/juxtaposition-ui/src/translations/fr.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
"followers": "Abonnés",
4848
"follow_user": "Suivre",
4949
"following_user": "Suivi(e)",
50-
"befriend": "Demander en ami",
50+
"befriend": "Demander en ami(e)",
5151
"pending": "En attente",
5252
"unfriend": "Retirer des amis",
5353
"no_friends": "Aucun ami",

apps/juxtaposition-ui/src/translations/hu.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
"text_hint": "Koppints ide egy új bejegyzés létrehozásához."
7474
},
7575
"messages": {
76-
"coming_soon": "Az Üzenetek még nincs kész. Nézz vissza később!"
76+
"coming_soon": "Nincs üzenet"
7777
},
7878
"setup": {
7979
"welcome": "Köszöntünk Juxtaposition-ben!",

apps/juxtaposition-ui/src/translations/id.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,6 @@
121121
"swearing": "Postingan tidak boleh mengandung bahasa eksplisit."
122122
},
123123
"messages": {
124-
"coming_soon": "Pesan-Pesan belum siap sekarang. Segara periksa kembali!"
124+
"coming_soon": "Tidak ada Pesanan"
125125
}
126126
}

apps/miiverse-api/src/models/post.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,13 @@ import type { PostData, PostPainting, PostScreenshot, PostTopicTag } from '@/typ
1212
* If you add default: or required:, please also update IPost and IPostInput!
1313
*/
1414
const PostSchema = new Schema<IPost, PostModel, IPostMethods>({
15-
id: { type: String, required: true },
15+
id: { type: String }, // generated in save hook
1616
title_id: { type: String },
1717
screen_name: { type: String, required: true },
18-
body: { type: String, required: true },
18+
body: {
19+
type: String,
20+
default: ''
21+
},
1922
app_data: { type: String },
2023

2124
painting: { type: String },

apps/miiverse-api/src/server.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,12 @@ app.use((_request: express.Request, response: express.Response) => {
6565

6666
// non-404 error handler
6767
logger.info('Creating non-404 status handler');
68-
app.use((_error: unknown, _request: express.Request, response: express.Response, _next: express.NextFunction) => {
68+
app.use((error: unknown, request: express.Request, response: express.Response, next: express.NextFunction) => {
69+
if (response.headersSent) {
70+
return next(error);
71+
}
72+
73+
request.log.error(request, 'Request failed!');
6974
return serverError(response, ApiErrorCode.UNKNOWN_ERROR);
7075
});
7176

apps/miiverse-api/src/types/mongoose/post.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ export interface IPost {
5757
// on input but not output
5858
// We really need an ORM
5959
type PostDefaultedFields =
60+
'id' | // generated in save hook
61+
'body' |
6062
'is_autopost' |
6163
'is_community_private_autopost' |
6264
'is_spoiler' |

0 commit comments

Comments
 (0)