Improve error handling
This commit is contained in:
parent
87bd780f9f
commit
e6a8150483
7 changed files with 78 additions and 62 deletions
12
core/src/lu/foyer/JsonApiError.scala
Normal file
12
core/src/lu/foyer/JsonApiError.scala
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
package lu.foyer
|
||||
|
||||
import zio.schema.*
|
||||
import zio.schema.annotation.discriminatorName
|
||||
|
||||
@discriminatorName("errorType")
|
||||
enum JsonApiError derives Schema:
|
||||
case NotFound(id: String)
|
||||
case InternalServerError(e: String)
|
||||
object JsonApiError:
|
||||
given Schema[JsonApiError.NotFound] = DeriveSchema.gen
|
||||
given Schema[JsonApiError.InternalServerError] = DeriveSchema.gen
|
||||
Loading…
Add table
Add a link
Reference in a new issue