web/admin: use SentryIgnoredError for user errors
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
7fb939f97b
commit
dad43017a0
|
@ -1,3 +1,4 @@
|
||||||
|
import { SentryIgnoredError } from "../common/errors";
|
||||||
import { VERSION } from "../constants";
|
import { VERSION } from "../constants";
|
||||||
|
|
||||||
export interface PlexPinResponse {
|
export interface PlexPinResponse {
|
||||||
|
@ -73,7 +74,7 @@ export class PlexAPIClient {
|
||||||
headers: headers,
|
headers: headers,
|
||||||
});
|
});
|
||||||
if (pinResponse.status > 200) {
|
if (pinResponse.status > 200) {
|
||||||
throw new Error("Invalid response code")
|
throw new SentryIgnoredError("Invalid response code")
|
||||||
}
|
}
|
||||||
const pin: PlexPinResponse = await pinResponse.json();
|
const pin: PlexPinResponse = await pinResponse.json();
|
||||||
console.debug(`authentik/plex: polling Pin`);
|
console.debug(`authentik/plex: polling Pin`);
|
||||||
|
|
|
@ -4,6 +4,7 @@ import { customElement, property } from "lit/decorators.js";
|
||||||
import PFAlertGroup from "@patternfly/patternfly/components/AlertGroup/alert-group.css";
|
import PFAlertGroup from "@patternfly/patternfly/components/AlertGroup/alert-group.css";
|
||||||
import PFBase from "@patternfly/patternfly/patternfly-base.css";
|
import PFBase from "@patternfly/patternfly/patternfly-base.css";
|
||||||
|
|
||||||
|
import { SentryIgnoredError } from "../../common/errors";
|
||||||
import { WSMessage } from "../../common/ws";
|
import { WSMessage } from "../../common/ws";
|
||||||
import { EVENT_WS_MESSAGE, WS_MSG_TYPE_MESSAGE } from "../../constants";
|
import { EVENT_WS_MESSAGE, WS_MSG_TYPE_MESSAGE } from "../../constants";
|
||||||
import "./Message";
|
import "./Message";
|
||||||
|
@ -12,7 +13,7 @@ import { APIMessage } from "./Message";
|
||||||
export function showMessage(message: APIMessage, unique = false): void {
|
export function showMessage(message: APIMessage, unique = false): void {
|
||||||
const container = document.querySelector<MessageContainer>("ak-message-container");
|
const container = document.querySelector<MessageContainer>("ak-message-container");
|
||||||
if (!container) {
|
if (!container) {
|
||||||
throw new Error("failed to find message container");
|
throw new SentryIgnoredError("failed to find message container");
|
||||||
}
|
}
|
||||||
container.addMessage(message, unique);
|
container.addMessage(message, unique);
|
||||||
container.requestUpdate();
|
container.requestUpdate();
|
||||||
|
|
|
@ -6,6 +6,7 @@ import { customElement } from "lit/decorators.js";
|
||||||
import { Flow, FlowsApi } from "@goauthentik/api";
|
import { Flow, FlowsApi } from "@goauthentik/api";
|
||||||
|
|
||||||
import { DEFAULT_CONFIG } from "../../api/Config";
|
import { DEFAULT_CONFIG } from "../../api/Config";
|
||||||
|
import { SentryIgnoredError } from "../../common/errors";
|
||||||
import { Form } from "../../elements/forms/Form";
|
import { Form } from "../../elements/forms/Form";
|
||||||
import "../../elements/forms/HorizontalFormElement";
|
import "../../elements/forms/HorizontalFormElement";
|
||||||
|
|
||||||
|
@ -19,7 +20,7 @@ export class FlowImportForm extends Form<Flow> {
|
||||||
send = (data: Flow): Promise<void> => {
|
send = (data: Flow): Promise<void> => {
|
||||||
const file = this.getFormFile();
|
const file = this.getFormFile();
|
||||||
if (!file) {
|
if (!file) {
|
||||||
throw new Error("No form data");
|
throw new SentryIgnoredError("No form data");
|
||||||
}
|
}
|
||||||
return new FlowsApi(DEFAULT_CONFIG).flowsInstancesImportFlowCreate({
|
return new FlowsApi(DEFAULT_CONFIG).flowsInstancesImportFlowCreate({
|
||||||
file: file,
|
file: file,
|
||||||
|
|
|
@ -12,6 +12,7 @@ import {
|
||||||
} from "@goauthentik/api";
|
} from "@goauthentik/api";
|
||||||
|
|
||||||
import { DEFAULT_CONFIG } from "../../../api/Config";
|
import { DEFAULT_CONFIG } from "../../../api/Config";
|
||||||
|
import { SentryIgnoredError } from "../../../common/errors";
|
||||||
import { Form } from "../../../elements/forms/Form";
|
import { Form } from "../../../elements/forms/Form";
|
||||||
import "../../../elements/forms/HorizontalFormElement";
|
import "../../../elements/forms/HorizontalFormElement";
|
||||||
|
|
||||||
|
@ -25,7 +26,7 @@ export class SAMLProviderImportForm extends Form<SAMLProvider> {
|
||||||
send = (data: SAMLProvider): Promise<void> => {
|
send = (data: SAMLProvider): Promise<void> => {
|
||||||
const file = this.getFormFile();
|
const file = this.getFormFile();
|
||||||
if (!file) {
|
if (!file) {
|
||||||
throw new Error("No form data");
|
throw new SentryIgnoredError("No form data");
|
||||||
}
|
}
|
||||||
return new ProvidersApi(DEFAULT_CONFIG).providersSamlImportMetadataCreate({
|
return new ProvidersApi(DEFAULT_CONFIG).providersSamlImportMetadataCreate({
|
||||||
file: file,
|
file: file,
|
||||||
|
|
|
@ -2,6 +2,7 @@ import { t } from "@lingui/macro";
|
||||||
|
|
||||||
import { TemplateResult, html } from "lit";
|
import { TemplateResult, html } from "lit";
|
||||||
|
|
||||||
|
import { SentryIgnoredError } from "./common/errors";
|
||||||
import "./elements/EmptyState";
|
import "./elements/EmptyState";
|
||||||
|
|
||||||
export function getCookie(name: string): string {
|
export function getCookie(name: string): string {
|
||||||
|
@ -73,7 +74,7 @@ export function first<T>(...args: Array<T | undefined | null>): T {
|
||||||
return element;
|
return element;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw new Error(`No compatible arg given: ${args}`);
|
throw new SentryIgnoredError(`No compatible arg given: ${args}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function hexEncode(buf: Uint8Array): string {
|
export function hexEncode(buf: Uint8Array): string {
|
||||||
|
|
Reference in New Issue