guest docs: log errors
All checks were successful
build-and-deploy / build-deploy (push) Successful in 32s
All checks were successful
build-and-deploy / build-deploy (push) Successful in 32s
This commit is contained in:
@@ -31,6 +31,7 @@ import java.nio.file.Files
|
|||||||
import java.nio.file.Paths
|
import java.nio.file.Paths
|
||||||
import java.util.UUID
|
import java.util.UUID
|
||||||
import java.security.MessageDigest
|
import java.security.MessageDigest
|
||||||
|
import org.slf4j.LoggerFactory
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/properties/{propertyId}/guests/{guestId}/documents")
|
@RequestMapping("/properties/{propertyId}/guests/{guestId}/documents")
|
||||||
@@ -52,6 +53,7 @@ class GuestDocuments(
|
|||||||
@org.springframework.beans.factory.annotation.Value("\${storage.documents.aiBaseUrl:\${storage.documents.publicBaseUrl}}")
|
@org.springframework.beans.factory.annotation.Value("\${storage.documents.aiBaseUrl:\${storage.documents.publicBaseUrl}}")
|
||||||
private val aiBaseUrl: String
|
private val aiBaseUrl: String
|
||||||
) {
|
) {
|
||||||
|
private val logger = LoggerFactory.getLogger(GuestDocuments::class.java)
|
||||||
|
|
||||||
@PostMapping
|
@PostMapping
|
||||||
@ResponseStatus(HttpStatus.CREATED)
|
@ResponseStatus(HttpStatus.CREATED)
|
||||||
@@ -220,8 +222,8 @@ class GuestDocuments(
|
|||||||
document.extractedAt = OffsetDateTime.now()
|
document.extractedAt = OffsetDateTime.now()
|
||||||
guestDocumentRepo.save(document)
|
guestDocumentRepo.save(document)
|
||||||
guestDocumentEvents.emit(propertyId, guestId)
|
guestDocumentEvents.emit(propertyId, guestId)
|
||||||
} catch (_: Exception) {
|
} catch (ex: Exception) {
|
||||||
// Keep upload successful even if AI extraction fails.
|
logger.warn("Document extraction failed for documentId={}", document.id, ex)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user