Json decoder for Schema[NonEmptyChunk] throws on empty json list
When using the `zio-json` decoder derived from a `Schema[NonEmptyChunk]`,
`decodeJson("[]")` throws an exception instead of returning a `Left` as expected.
```scala
import zio.NonEmptyChunk
import zio.schema.codec.JsonCodec.jsonDecoder
import zio.schema.Schema
val schema = Schema[NonEmptyChunk[String]]
val decoder = jsonDecoder(schema)
decoder.decodeJson("[]") // this throws a java.lang.IllegalArgumentException: NonEmptySequence NonEmptyChunk cannot be empty)
```
`decodeJson` is defined as
```scala
def decodeJson(str: CharSequence): Either[String, A]
```
so I expect it returns a `Left` instead of throwing.
The exception originates [here](https://github.com/zio/zio-schema/blob/43411a031200cad1817b8e20b94802bd255b33ec/zio-schema/shared/src/main/scala/zio/schema/Schema.scala#L905).
The same exception is thrown for `NonEmptySet` as well.
0 条评论