web: only report http errors for 500 and above

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-04-22 19:51:32 +02:00
parent 003df44a34
commit 9d3b6f7a4d
1 changed files with 7 additions and 2 deletions

View File

@ -24,8 +24,13 @@ export function configureSentry(): Promise<Config> {
return null;
}
if (hint.originalException instanceof Response) {
const body = await hint.originalException.json();
event.message = `${hint.originalException.status} ${hint.originalException.url}: ${JSON.stringify(body)}`
const response = hint.originalException as Response;
// We only care about server errors
if (response.status < 500) {
return null;
}
const body = await response.json();
event.message = `${response.status} ${response.url}: ${JSON.stringify(body)}`
}
if (event.exception) {
me().then(user => {