Chunk #627

Aus: Chat-API (Index: 5)

106 Tokens
Synced Status
« Vorheriger (#4) Nächster (#6) »

Taxonomie

Kategorie API
Pfad API > Error Handling > Exception Handling
Heading-Pfad Chat-API > Chat API > Fehlerbehandlung > Exception-Handling

Entities

Name Typ
RuntimeException TECHNOLOGY
AIConfig CONFIG
ChatService SERVICE
chat COMMAND

Keywords

error logging HTTP 500 JSON response RuntimeException

Inhalt

Alle Services werfen RuntimeException bei Fehlern:

try {
    $config = AIConfig::fromCredentialsFile();
    $chat = $config->createChatService();
    $result = $chat->chat($question);
} catch (RuntimeException $e) {
    // Fehler-Logging
    error_log('Chat failed: ' . $e->getMessage());

    // JSON Response
    http_response_code(500);
    echo json_encode([
        'error' => 'Chat request failed',
        'message' => $e->getMessage()
    ]);
}

Clean Content

Alle Services werfen RuntimeException bei Fehlern:

```
`try {
 $config = AIConfig::fromCredentialsFile();
 $chat = $config->createChatService();
 $result = $chat->chat($question);
} catch (RuntimeException $e) {
 // Fehler-Logging
 error_log('Chat failed: ' . $e->getMessage());

 // JSON Response
 http_response_code(500);
 echo json_encode([
 'error' => 'Chat request failed',
 'message' => $e->getMessage()
 ]);
}`
```

Metadaten

Analysiert am20.12.2025 12:47:56
Analyse-Modellgemma3:4b-it-qat
Embedding-Modellmxbai-embed-large
Qdrant-IDa9758008-288a-4084-89b1-e2547f7ca8b8
Erstellt20.12.2025 12:34:42
Aktualisiert20.12.2025 12:53:41