zio-http icon indicating copy to clipboard operation
zio-http copied to clipboard

Custom Descriptive Error Message When Trying to Serve Routes with Unhandled Errors

Open khajavi opened this issue 10 months ago • 1 comments

When trying to serve an unhandled route, it is a good idea to create a custom error message using implicit resolution. This message should provide descriptive guidance to the user, explain why the route is not going to be served, and ask the user to handle all errors.

The current error message is like below:

overloaded method serves with alternatives:
  [R](route: zio.http.Route[R,zio.http.Response], routes: zio.http.Route[R,zio.http.Response]*)(implicit trace: zio.Trace, tag: zio.EnvironmentTag[R]): zio.URIO[R with zio.http.Server,Nothing] <and>
  [R](routes: zio.http.Routes[R,zio.http.Response])(implicit trace: zio.Trace, tag: zio.EnvironmentTag[R]): zio.URIO[R with zio.http.Server,Nothing]
 cannot be applied to (zio.http.Route[example.UserProfileService,example.UserProfileError])

khajavi avatar Feb 18 '25 12:02 khajavi

The error channel will be gone with 4.x Not sure if we still need this for 3.x I will keep this for 3.8 but likely will discard this.

987Nabil avatar Nov 30 '25 08:11 987Nabil