DimensionMismatchException.php
- Pfad:
src/Domain/Exception/DimensionMismatchException.php - Namespace: Domain\Exception
- Zeilen: 55 | Größe: 1,459 Bytes
- Geändert: 2025-12-23 08:07:54 | Gescannt: 2025-12-31 10:22:15
Code Hygiene Score: 100
- Dependencies: 100 (25%)
- LOC: 100 (20%)
- Methods: 100 (20%)
- Secrets: 100 (15%)
- Classes: 100 (10%)
- Magic Numbers: 100 (10%)
Keine Issues gefunden.
Dependencies 2
- extends RuntimeException
- use RuntimeException
Klassen 1
-
DimensionMismatchExceptionclass Zeile 11
Funktionen 3
-
__construct()public Zeile 13 -
incompatibleCollections()public Zeile 27 -
embeddingMismatch()Zeile 42
Versionen 1
-
v1
2025-12-23 08:07 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation
Code
<?php
declare(strict_types=1);
namespace Domain\Exception;
// @responsibility: Exception bei Vektor-Dimensions-Inkompatibilität
use RuntimeException;
class DimensionMismatchException extends RuntimeException
{
public function __construct(
string $message,
public readonly ?string $collectionId = null,
public readonly ?int $expectedSize = null,
public readonly ?int $actualSize = null
) {
parent::__construct($message);
}
/**
* Create exception for incompatible collections.
*
* @param array<string, int> $collectionSizes Map of collection_id => vector_size
*/
public static function incompatibleCollections(array $collectionSizes): self
{
$details = [];
foreach ($collectionSizes as $id => $size) {
$details[] = "$id: {$size}d";
}
return new self(
'Inkompatible Collections: Unterschiedliche Vektorgrößen (' . implode(', ', $details) . ')'
);
}
/**
* Create exception for embedding size mismatch.
*/
public static function embeddingMismatch(
string $collectionId,
int $expectedSize,
int $actualSize
): self {
return new self(
"Dimension Mismatch: Collection '$collectionId' erwartet {$expectedSize}d, Embedding hat {$actualSize}d",
$collectionId,
$expectedSize,
$actualSize
);
}
}