Skip to content

Fix: Return 404 instead of 500 when conference not found in checkout endpoint#147

Merged
denbec merged 2 commits intodenbec/automation-reviewfrom
copilot/sub-pr-146
Feb 26, 2026
Merged

Fix: Return 404 instead of 500 when conference not found in checkout endpoint#147
denbec merged 2 commits intodenbec/automation-reviewfrom
copilot/sub-pr-146

Conversation

Copy link
Contributor

Copilot AI commented Feb 26, 2026

When directus.getConference() throws for a non-existent conference, the Directus SDK error lacks a statusCode property, causing the outer catch to fall through to the generic 500 handler instead of the expected 404.

Change

Added a response.status check in the outer catch block of create-checkout.post.ts:

} catch (err: any) {
    if (err.statusCode) {
        throw err
    }
    if (err?.response?.status === 404) {
        throw createError({ statusCode: 404, message: 'Konferenz nicht gefunden' })
    }
    console.error('Checkout creation error:', err)
    throw createError({ statusCode: 500, message: 'Ein Fehler ist beim Erstellen der Bestellung aufgetreten.' })
}

The Directus SDK (@directus/sdk v17, REST transport) surfaces the HTTP response on err.response, so checking err?.response?.status === 404 reliably identifies not-found errors without coupling to SDK-internal error codes.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@vercel
Copy link

vercel bot commented Feb 26, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
programmierbar-website Ready Ready Preview, Comment Feb 26, 2026 1:36pm

Request Review

Co-authored-by: denbec <193931+denbec@users.noreply.github.com>
Copilot AI changed the title [WIP] WIP: Address feedback on Denbec/automation review PR Fix: Return 404 instead of 500 when conference not found in checkout endpoint Feb 26, 2026
@denbec denbec marked this pull request as ready for review February 26, 2026 13:36
@denbec denbec merged commit 5fcd7c1 into denbec/automation-review Feb 26, 2026
2 checks passed
@denbec denbec deleted the copilot/sub-pr-146 branch February 26, 2026 13:36
denbec added a commit that referenced this pull request Feb 26, 2026
* Switch speaker portal admin notifications to Slack (#140)

Replace email-based admin notifications with Slack messages when speakers submit their information. This aligns with the existing pattern used across other CMS hooks (deploy, publication, transcripts, etc.) where all admin notifications go through Slack. The message includes a direct link to the speaker record in Directus for easy access.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

* Add Slack notifications to member matching failures (#141)

* Add Slack notifications to member matching on failures

Member matching now alerts the team when:
- No speaker names are found in a transcript (transcript format issue)
- No members can be matched to speakers (missing database entries)
- A general error occurs during matching

Also added support for triggering on podcast creation (previously only on update), ensuring member matching works even when transcript_text is included at creation time. Fixed Jest config to resolve ESM .js imports to .ts source files.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>

* Use .ts import extension for postSlackMessage to match codebase convention

Removes the jest.config.ts moduleNameMapper change that was only needed
because the imports used .js extensions. All other files in the codebase
import postSlackMessage with .ts, so this aligns with that convention.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Haiku 4.5 <noreply@anthropic.com>

* Fix content generation code review issues (#142)

Address all code review points: remove unused prompt files, extract shared LLM utilities, remove fallback prompts and dangerous environment variable fallbacks, add Slack failure notifications with Directus links, handle content unapproval, fix asset regeneration to avoid broken references, and use Directus date-created for generated_at timestamps.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

* Consolidate Directus API access and reorganize types/schemas (#143)

Merge multiple token-based approaches into a single authenticated Directus composable (useAuthenticatedDirectus) to centralize CMS operations. Unify directusAdminToken + directusTicketToken into a single directusApiToken.

Fix race condition in webhook idempotency by restoring atomic filter-based updates. Extend type definitions to include missing speaker portal and ticket fields, removing unnecessary 'as any' casts. Move ticket Directus types to directus.ts and ticket checkout types to items.ts (deleted tickets.ts). Consolidate all validation schemas into a single schema.ts file (deleted ticketSchemas.ts).

Net reduction of 266 lines of code.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

* Refactor conference page to use internal ticketing system (#144)

Replace external Wix.com ticket links with internal /konferenzen/[slug]/tickets
route. Remove obsolete fields (tickets, tickets_url, tickets_on_sale) from
DirectusConferenceItem. Use ticketing_enabled flag and conference end_on date
to control ticket section visibility. Enable server-side ticketing_enabled guard
in checkout endpoint.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

* Refactor VAT rate to centralized constants and add VAT ID field (#145)

Centralizes the VAT rate (19%) into config.ts constants (VAT_RATE and VAT_RATE_PERCENT), adds an optional VAT ID input field to company billing info with proper schema validation, and refactors the checkout endpoint into typed helper functions for better maintainability.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

* Fix: Return 404 instead of 500 when conference not found in checkout endpoint (#147)

* Initial plan

* Fix: Return 404 when conference not found in create-checkout endpoint

Co-authored-by: denbec <193931+denbec@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: denbec <193931+denbec@users.noreply.github.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: denbec <193931+denbec@users.noreply.github.com>
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

Successfully merging this pull request may close these issues.

2 participants