diff --git a/api/src/lu/foyer/JsonApiController.scala b/api/src/lu/foyer/JsonApiController.scala index 5fdda84..8a6b8f2 100644 --- a/api/src/lu/foyer/JsonApiController.scala +++ b/api/src/lu/foyer/JsonApiController.scala @@ -103,7 +103,10 @@ trait JsonApiController: endpoint.implement(input => for item <- f(input) - .tapErrorCause(ZIO.logErrorCause(_)) + .tapError { + case t: Throwable => ZIO.logErrorCause(Cause.fail(t)) + case _: JsonApiError => ZIO.unit + } .mapError { case e: Throwable => JsonApiError.InternalServerError(e.getMessage) case e: JsonApiError => e diff --git a/core/src/lu/foyer/EventSourcing.scala b/core/src/lu/foyer/EventSourcing.scala index 8d765d0..6875137 100644 --- a/core/src/lu/foyer/EventSourcing.scala +++ b/core/src/lu/foyer/EventSourcing.scala @@ -34,8 +34,7 @@ trait CommandHandlerCreate[Command: Schema, Event] extends CommandHandler[Comman trait CommandHandlerUpdate[Command: Schema, Event, State] extends CommandHandler[Command, Event, State]: - def onCommand(entityId: String, state: State, command: Command) - : IO[JsonApiError | Throwable, Event] + def onCommand(entityId: String, state: State, command: Command) : IO[JsonApiError | Throwable, Event] val isCreate = false val commandSchema = summon[Schema[Command]]