mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-04 21:04:37 +08:00
Docstring for captureError
This commit is contained in:
parent
343ae8dcfd
commit
dd8783af09
@ -56,7 +56,7 @@ export class OAuthModel implements AuthorizationCodeModel {
|
||||
({ domain, handler_path }) => new URL(handler_path, domain).toString()
|
||||
);
|
||||
} catch (e) {
|
||||
captureError("get redirect uris", {
|
||||
captureError("get-oauth-redirect-urls", {
|
||||
error: e,
|
||||
projectId: tenancy.project.id,
|
||||
domains: tenancy.config.domains,
|
||||
|
||||
@ -112,6 +112,15 @@ registerErrorSink((location, error, ...extraArgs) => {
|
||||
globalVar.stackCapturedErrors.push({ location, error, extraArgs });
|
||||
});
|
||||
|
||||
/**
|
||||
* Captures an error and sends it to the error sinks (most notably, Sentry). Errors caught with captureError are
|
||||
* supposed to be seen by an engineer, so they should be actionable and important.
|
||||
*
|
||||
* The location string is a machine-readable ID, and should hence not contain spaces or anything like that. Good
|
||||
* examples are: "api-route-handler", "renderPart()", etc.
|
||||
*
|
||||
* Errors that bubble up to the top of runAsynchronously or a route handler are already captured with captureError.
|
||||
*/
|
||||
export function captureError(location: string, error: unknown): void {
|
||||
for (const sink of errorSinks) {
|
||||
sink(
|
||||
|
||||
@ -93,7 +93,7 @@ export function ActiveSessionsPage(props?: {
|
||||
await userFromHook.revokeSession(sessionId);
|
||||
setSessions(prev => prev.filter(session => session.id !== sessionId));
|
||||
} catch (error) {
|
||||
captureError("Failed to revoke session", { sessionId ,error });
|
||||
captureError("session-revoke", { sessionId ,error });
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
@ -112,7 +112,7 @@ export function ActiveSessionsPage(props?: {
|
||||
setSessions(prevSessions => prevSessions.filter(session => session.isCurrentSession));
|
||||
}
|
||||
} catch (error) {
|
||||
captureError("Failed to revoke all sessions", { error, sessionIds: sessions.map(session => session.id) });
|
||||
captureError("all-sessions-revoke", { error, sessionIds: sessions.map(session => session.id) });
|
||||
throw error;
|
||||
} finally {
|
||||
setIsRevokingAll(false);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user