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

Error not being logged in beforeRetry hook #665

Open
taejinii opened this issue Dec 26, 2024 · 0 comments
Open

Error not being logged in beforeRetry hook #665

taejinii opened this issue Dec 26, 2024 · 0 comments

Comments

@taejinii
Copy link

taejinii commented Dec 26, 2024

// api/instance.ts
import ky, { type BeforeRequestHook, type BeforeRetryHook } from 'ky'

const beforeRetryHook: BeforeRetryHook = ({
  request,
  options,
  error,
  retryCount,
}) => {
  console.log('test', error) // This error is not being logged
}

const api = ky.create({
  prefixUrl: 'https://api.example.com',
  headers: {
    'Content-Type': 'application/json',
  },
  hooks: {
    beforeRetry: [beforeRetryHook],
  },
})

// Using with React Query
// provider/QueryProvider.tsx
const queryClient = new QueryClient({
  defaultOptions: {
    queries: {},
    mutations: {},
  },
})

I'm experiencing an issue where the error parameter in the beforeRetry hook is not being logged to the console. I'm using ky with React Query in a React Native (Expo) application.

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

No branches or pull requests

1 participant