Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix logged errors not being properly formatted (and tone down the error verbosity a bit) #874

Merged
merged 4 commits into from
Jan 2, 2024

Conversation

Half-Shot
Copy link
Contributor

So we go from:

Error: API error HS_METHOD_NOT_ALLOWED: Invalid Method. Expecting PUT or POST
    at GenericWebhooksRouter.onWebhook (/usr/bin/matrix-hookshot/generic/Router.js:41:19)
    at Layer.handle [as handle_request] (/usr/bin/matrix-hookshot/node_modules/express/lib/router/layer.js:95:5)
    at next (/usr/bin/matrix-hookshot/node_modules/express/lib/router/route.js:144:13)
    at textParser (/usr/bin/matrix-hookshot/node_modules/body-parser/lib/types/text.js:69:7)
    at Layer.handle [as handle_request] (/usr/bin/matrix-hookshot/node_modules/express/lib/router/layer.js:95:5)
    at next (/usr/bin/matrix-hookshot/node_modules/express/lib/router/route.js:144:13)
    at jsonParser (/usr/bin/matrix-hookshot/node_modules/body-parser/lib/types/json.js:110:7)
    at Layer.handle [as handle_request] (/usr/bin/matrix-hookshot/node_modules/express/lib/router/layer.js:95:5)
    at next (/usr/bin/matrix-hookshot/node_modules/express/lib/router/route.js:144:13)
    at urlencodedParser (/usr/bin/matrix-hookshot/node_modules/body-parser/lib/types/urlencoded.js:91:7)
    at Layer.handle [as handle_request] (/usr/bin/matrix-hookshot/node_modules/express/lib/router/layer.js:95:5)
    at next (/usr/bin/matrix-hookshot/node_modules/express/lib/router/route.js:144:13)
    at /usr/bin/matrix-hookshot/generic/Router.js:94:17
    at textParser (/usr/bin/matrix-hookshot/node_modules/body-parser/lib/types/text.js:69:7)
    at xmlHandler (/usr/bin/matrix-hookshot/generic/Router.js:88:60)
    at Layer.handle [as handle_request] (/usr/bin/matrix-hookshot/node_modules/express/lib/router/layer.js:95:5)

to

INFO 13:09:06:567 [ListenerService] GET /sadsa 405 - HS_METHOD_NOT_ALLOWED - Invalid Method. Expecting PUT or POST
DEBUG 13:09:06:567 [ListenerService] ApiError: API error HS_METHOD_NOT_ALLOWED: Invalid Method. Expecting PUT or POST
    at GenericWebhooksRouter.onWebhook (/home/will/git/matrix-hookshot/src/generic/Router.ts:16:18)
    at Layer.handle [as handle_request] (/home/will/git/matrix-hookshot/node_modules/express/lib/router/layer.js:95:5)
    at next (/home/will/git/matrix-hookshot/node_modules/express/lib/router/route.js:144:13)
    at textParser (/home/will/git/matrix-hookshot/node_modules/body-parser/lib/types/text.js:69:7)
    at Layer.handle [as handle_request] (/home/will/git/matrix-hookshot/node_modules/express/lib/router/layer.js:95:5)
    at next (/home/will/git/matrix-hookshot/node_modules/express/lib/router/route.js:144:13)
    at jsonParser (/home/will/git/matrix-hookshot/node_modules/body-parser/lib/types/json.js:110:7)
    at Layer.handle [as handle_request] (/home/will/git/matrix-hookshot/node_modules/express/lib/router/layer.js:95:5)
    at next (/home/will/git/matrix-hookshot/node_modules/express/lib/router/route.js:144:13)
    at urlencodedParser (/home/will/git/matrix-hookshot/node_modules/body-parser/lib/types/urlencoded.js:91:7)
    at Layer.handle [as handle_request] (/home/will/git/matrix-hookshot/node_modules/express/lib/router/layer.js:95:5)
    at next (/home/will/git/matrix-hookshot/node_modules/express/lib/router/route.js:144:13)
    at /home/will/git/matrix-hookshot/src/generic/Router.ts:70:17
    at textParser (/home/will/git/matrix-hookshot/node_modules/body-parser/lib/types/text.js:69:7)
    at xmlHandler (/home/will/git/matrix-hookshot/src/generic/Router.ts:64:50)
    at Layer.handle [as handle_request] (/home/will/git/matrix-hookshot/node_modules/express/lib/router/layer.js:95:5) {
  error: 'Invalid Method. Expecting PUT or POST',
  errcode: 'HS_METHOD_NOT_ALLOWED',
  statusCode: 405,
  additionalContent: {}
}

@Half-Shot Half-Shot requested a review from a team as a code owner January 2, 2024 13:15
@Half-Shot Half-Shot enabled auto-merge January 2, 2024 15:55
@Half-Shot Half-Shot added this pull request to the merge queue Jan 2, 2024
Merged via the queue into main with commit 41ee467 Jan 2, 2024
16 checks passed
@Half-Shot Half-Shot deleted the hs/logging-fix branch January 2, 2024 16:02
Half-Shot added a commit that referenced this pull request Jan 2, 2024
Bugfixes
--------

- Fix widget pinning to light theme. ([\#873](#873))
- Fix hookshot failing to format API errors.
  Only log a stacktrace of API errors on debug level logging, log limited error on info. ([\#874](#874))
- Fix GitHub events not working due to verification failures. ([\#875](#875))

Internal Changes
----------------

- Fix spelling of "successfully". ([\#869](#869))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant