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

packages/tailwindcss/src/compile.ts #18238

Closed
lvrocky opened this issue Mar 25, 2024 · 1 comment
Closed

packages/tailwindcss/src/compile.ts #18238

lvrocky opened this issue Mar 25, 2024 · 1 comment

Comments

@lvrocky
Copy link

lvrocky commented Mar 25, 2024

export function compileCandidates(
rawCandidates: Iterable,
designSystem: DesignSystem,
{ onInvalidCandidate }: { onInvalidCandidate?: (candidate: string) => void } = {},
) {
// ...

for (let rawCandidate of rawCandidates) {
let candidate = designSystem.parseCandidate(rawCandidate)
if (candidate === null) {
if (onInvalidCandidate) {
onInvalidCandidate(rawCandidate);
} else {
throw new Error(Invalid candidate: "${rawCandidate}");
}
continue; // Bail, invalid candidate
}
candidates.set(candidate, rawCandidate);
}

// ...
}

export function compileAstNodes(rawCandidate: string, designSystem: DesignSystem) {
let candidate = designSystem.parseCandidate(rawCandidate);
if (candidate === null) {
throw new Error(Invalid candidate: "${rawCandidate}");
}

// ...
}

  1. Specific Error Messages:
    • Problem: Current error handling mainly involves calling the onInvalidCandidate callback function to handle invalid candidates, and printing corresponding error messages to the console.
    • Optimization Suggestion: Directly throw an error with specific error messages when encountering invalid candidates, providing better insight into what went wrong.
@snitin315
Copy link
Member

We appreciate your effort in raising this issue. To ensure clarity in understanding your situation, we kindly request you recreate the issue using one of our templates.

Your collaboration will help us in providing you with effective assistance.

@snitin315 snitin315 closed this as not planned Won't fix, can't repro, duplicate, stale Mar 25, 2024
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

2 participants