Skip to content

fix(MAJORLEA-005-2): frontend/src/services/hiring.ts silently swallows errors and returns empty array instead of throwing - #79

Draft
flamingo[bot] wants to merge 1 commit into
mainfrom
ai-fix/majorlea-005-2-065c0487-8f1c6ef6
Draft

fix(MAJORLEA-005-2): frontend/src/services/hiring.ts silently swallows errors and returns empty array instead of throwing#79
flamingo[bot] wants to merge 1 commit into
mainfrom
ai-fix/majorlea-005-2-065c0487-8f1c6ef6

Conversation

@flamingo

@flamingo flamingo Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Closes findings from rule MAJORLEA-005-2 — frontend/src/services/hiring.ts silently swallows errors and returns empty array instead of throwing.

Draft — this is a starting point, not a finished change. The fix required judgment, so read it before trusting it.

# Fix confidence Finding Location
1 🟡 85 medium frontend/src/services/hiring.ts silently swallows errors and returns empty array instead of throwing frontend/src/services/hiring.ts:4

What changed — and what was deliberately left — is explained per finding as inline review comments on the lines each finding touched.


Run: https://product-hub.flamingo.so/admin/code-review
Run id: 8f1c6ef6-6b61-4dcd-bb0e-59bc6a7d37e8

Merging this PR is recorded as acceptance of the rule that produced it;
closing it unmerged is recorded as rejection. Both feed rule health, so
closing a wrong suggestion is useful rather than merely tidy.

…s errors and returns empty array instead of throwing

@flamingo flamingo Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦩 What this fix changed, finding by finding

1 finding(s) fixed in this draft — 1 explained inline on the diff.

@@ -2,12 +2,6 @@ import { JobOpening } from '../types/hiring';
import { getJobOpenings } from './api';

export const fetchJobOpenings = async (): Promise<JobOpening[]> => {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦩 🔴 frontend/src/services/hiring.ts silently swallows errors and returns empty array instead of throwing

Removed the try/catch block in fetchJobOpenings entirely, so any error thrown by getJobOpenings() (network failure, non-success status, etc.) now propagates to the caller (useHiring hook) instead of being silently swallowed and returning an empty array. The caller can now distinguish a real failure from a legitimately empty job list and show proper error UI. The console.error log and the return [] fallback were both removed. If getJobOpenings() itself does not already throw on response.data.status !== 'success', that check would need to be added in api.ts (not in scope here); however, this change is the correct minimal fix for the silent-swallow pattern identified in this file.

🤖 Prompt for AI agents
In frontend/src/services/hiring.ts around line 4, review and complete this code-review fix: frontend/src/services/hiring.ts silently swallows errors and returns empty array instead of throwing.
What the draft fix changed: Removed the try/catch block in `fetchJobOpenings` entirely, so any error thrown by `getJobOpenings()` (network failure, non-success status, etc.) now propagates to the caller (`useHiring` hook) instead of being silently swallowed and returning an empty array. The caller can now distinguish a real failure from a legitimately empty job list and show proper error UI. The `console.error` log and the `return []` fallback were both removed. If `getJobOpenings()` itself does not already throw on `response.data.status !== 'success'`, that check would need to be added in `api.ts` (not in scope here); however, this change is the correct minimal fix for the silent-swallow pattern identified in this file.
Verify the change is correct and complete; do not refactor unrelated code.

fix confidence: 🟡 85 medium — react 👍/👎 to teach the reviewer

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.

0 participants