From 74eb4678ad42fa464208a1a037285a56407e9b70 Mon Sep 17 00:00:00 2001 From: Alex Rozanski Date: Wed, 3 May 2023 09:01:46 +0100 Subject: [PATCH] fix error handling in LlamaEvent also fixes #4 --- Sources/llama/LlamaRunner.swift | 2 +- Sources/llamaObjCxx/bridge/LlamaEvent.mm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/llama/LlamaRunner.swift b/Sources/llama/LlamaRunner.swift index 3c652687de9c6..08f8b8d973fe0 100644 --- a/Sources/llama/LlamaRunner.swift +++ b/Sources/llama/LlamaRunner.swift @@ -36,7 +36,7 @@ public class LlamaRunner { case initializing case generatingOutput case completed - case failed(error: Error) + case failed(error: Error?) } public let modelURL: URL diff --git a/Sources/llamaObjCxx/bridge/LlamaEvent.mm b/Sources/llamaObjCxx/bridge/LlamaEvent.mm index 880b506e69b57..b1f34a9005f0d 100644 --- a/Sources/llamaObjCxx/bridge/LlamaEvent.mm +++ b/Sources/llamaObjCxx/bridge/LlamaEvent.mm @@ -78,7 +78,7 @@ + (instancetype)completed + (instancetype)failedWithError:(nonnull NSError *)error { - _LlamaEvent *event = [[_LlamaEvent alloc] initWithEventType:LlamaEventTypeFailed data:{}]; + _LlamaEvent *event = [[_LlamaEvent alloc] initWithEventType:LlamaEventTypeFailed data:{ .failed_error = error }]; return event; }