mirror of
https://github.com/xtr-dev/rondevu-server.git
synced 2025-12-13 20:33:25 +00:00
Add candidate validation to addIceCandidates()
Validation: Add basic candidate validation - Validate each candidate is an object - Don't enforce specific structure (per CLAUDE.md guidelines) - Provides clear error messages with index Impact: Prevents runtime errors from null/primitive values Note: Intentionally keeps candidate structure flexible per design
This commit is contained in:
@@ -600,6 +600,13 @@ const handlers: Record<string, RpcHandler> = {
|
||||
throw new Error('Missing or invalid required parameter: candidates');
|
||||
}
|
||||
|
||||
// Validate each candidate is an object (don't enforce structure per CLAUDE.md)
|
||||
candidates.forEach((candidate, index) => {
|
||||
if (!candidate || typeof candidate !== 'object') {
|
||||
throw new Error(`Invalid candidate at index ${index}: must be an object`);
|
||||
}
|
||||
});
|
||||
|
||||
const offer = await storage.getOfferById(offerId);
|
||||
if (!offer) {
|
||||
throw new Error('Offer not found');
|
||||
|
||||
Reference in New Issue
Block a user