Clean logging
This commit is contained in:
parent
e6a8150483
commit
25318cd6de
2 changed files with 5 additions and 3 deletions
|
|
@ -103,7 +103,10 @@ trait JsonApiController:
|
||||||
endpoint.implement(input =>
|
endpoint.implement(input =>
|
||||||
for
|
for
|
||||||
item <- f(input)
|
item <- f(input)
|
||||||
.tapErrorCause(ZIO.logErrorCause(_))
|
.tapError {
|
||||||
|
case t: Throwable => ZIO.logErrorCause(Cause.fail(t))
|
||||||
|
case _: JsonApiError => ZIO.unit
|
||||||
|
}
|
||||||
.mapError {
|
.mapError {
|
||||||
case e: Throwable => JsonApiError.InternalServerError(e.getMessage)
|
case e: Throwable => JsonApiError.InternalServerError(e.getMessage)
|
||||||
case e: JsonApiError => e
|
case e: JsonApiError => e
|
||||||
|
|
|
||||||
|
|
@ -34,8 +34,7 @@ trait CommandHandlerCreate[Command: Schema, Event] extends CommandHandler[Comman
|
||||||
|
|
||||||
trait CommandHandlerUpdate[Command: Schema, Event, State]
|
trait CommandHandlerUpdate[Command: Schema, Event, State]
|
||||||
extends CommandHandler[Command, Event, State]:
|
extends CommandHandler[Command, Event, State]:
|
||||||
def onCommand(entityId: String, state: State, command: Command)
|
def onCommand(entityId: String, state: State, command: Command) : IO[JsonApiError | Throwable, Event]
|
||||||
: IO[JsonApiError | Throwable, Event]
|
|
||||||
val isCreate = false
|
val isCreate = false
|
||||||
val commandSchema = summon[Schema[Command]]
|
val commandSchema = summon[Schema[Command]]
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue