Uh oh!
There was an error while loading. Please reload this page.
feat(hono): Add warning in Bun for double init - #21195
Conversation
nicohrubec
left a comment
There was a problem hiding this comment.
nice. should we do this for cloudflare as well?
| expect(warnSpy).toHaveBeenCalledWith(expect.stringContaining('Sentry is already initialized')); | ||
| }); | ||
| it('warns that initialization should only happen through the sentry() middleware', () => { |
There was a problem hiding this comment.
l: should this test and the one before maybe be merged? i.e. just have one "warns if sentry is already initialized" and then check both logs or just check that the spy is being called
| export function init(options: HonoBunOptions): Client | undefined { | ||
| const existingClient = getClient(); | ||
| if (existingClient) { | ||
| debug.warn( |
There was a problem hiding this comment.
maybe do a console.warn here (wrapped in consoleSandbox)? 🤔
There was a problem hiding this comment.
also I would probably not return early here but still run init again, second init should take precedence I suppose in such a scenario...? (as much as it can, it will be kind of buggy for sure either way)
s1gr1d
commented
May 28, 2026
Applied your suggestions, they all make sense :) |
Reference #21176