Skip to content

Commit 6f28755

Browse files
hgwoodErrorname
authored andcommitted
🐛 fix crash in case of prisma error when answering (#240)
1 parent 121703f commit 6f28755

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

server/src/resolvers/answer.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,12 @@ module.exports = {
4141
)
4242
} catch (e) {
4343
// The error doesn't includes the error code, so we use the message
44-
if (e.message.includes('NodeAnswer') && e.message.includes('violate')) {
44+
if (
45+
e.message &&
46+
e.message.includes &&
47+
e.message.includes('NodeAnswer') &&
48+
e.message.includes('violate')
49+
) {
4550
throw new Error('Someone already answered this question! Refresh this page.')
4651
}
4752
throw e

0 commit comments

Comments
 (0)