Skip to content

Error not being logged in beforeRetry hook #665

Open
@taejinii

Description

@taejinii
// 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions