Skip to content

Commit

Permalink
Fixes #436: Server crashes when webhook onConnect fails
Browse files Browse the repository at this point in the history
  • Loading branch information
janthurau committed Nov 7, 2022
1 parent c39062c commit 2020e5b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/extension-webhook/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"dist"
],
"dependencies": {
"@hocuspocus/common": "^1.0.0-beta.3",
"@hocuspocus/server": "^1.0.0-beta.3",
"@hocuspocus/transformer": "^1.0.0-beta.3",
"axios": "^0.27.2"
Expand Down
5 changes: 3 additions & 2 deletions packages/extension-webhook/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
import { Doc } from 'yjs'
import { TiptapTransformer, Transformer } from '@hocuspocus/transformer'
import axios, { AxiosResponse } from 'axios'
import { Forbidden } from '@hocuspocus/common'

export enum Events {
onChange = 'change',
Expand Down Expand Up @@ -175,8 +176,8 @@ export class Webhook implements Extension {
? JSON.parse(response.data)
: response.data
} catch (e) {
// eslint-disable-next-line no-throw-literal
throw null
console.error(`Caught error in extension-webhook: ${e}`)
throw Forbidden
}
}

Expand Down

0 comments on commit 2020e5b

Please sign in to comment.