MCPcopy Create free account
hub / github.com/better-auth/examples / onError

Function onError

astro-example/src/components/two-factor.tsx:26–39  ·  view source on GitHub ↗
(context)

Source from the content-addressed store, hash-verified

24 code: otp(),
25 fetchOptions: {
26 onError(context) {
27 if (context.error.status === 429) {
28 const retryAfter = context.response.headers.get("X-Retry-After");
29 alert(
30 `Too many requests. Please try again after ${retryAfter} seconds`,
31 );
32 } else {
33 alert(
34 context.error.message ||
35 context.error.statusText ||
36 context.error.status,
37 );
38 }
39 },
40 },
41 });
42 }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected