akka / akka/akka-http

ExceptionHandlerExamplesSpec in docs cannot be copy / pasted

Open Beginner friendly
#3,971 0 comments 0 reactions 0 assignees View on GitHub
1 - triaged help wanted t:docs
Dominant language
Scala
Stars
1.4k
Forks
584
Avg merge
14h 33m
Merged PRs (30d)
24

Description

> > [Some examples](https://github.com/akka/akka-http/blob/main/docs/src/test/scala/docs/http/scaladsl/server/ExceptionHandlerExamplesSpec.scala?rgh-link-date=2021-12-12T07%3A11%3A30Z#L24) are broken again.

The example doesn't compile.
The problem that was addressed in this PR needs to be addressed again in the same way. Essentially `myExceptionHandler` cannot be a top-level entity with respect to a file (in Scala 2), it should be in `MyApp`. The specification compiles because this snippet is itself in `MyExplicitExceptionHandler`, but a user looking at the documentation is unlikely to figure that out.

_Originally posted by @FlorianCassayre in https://github.com/akka/akka-http/issues/1465#issuecomment-993396956_

Contributor guide

Open the contributing guide

Research direction

Start with docs/src/test/scala/docs/http/scaladsl/server/ExceptionHandlerExamplesSpec.scala, especially the ExceptionHandlerExamplesSpec snippet and its MyExplicitExceptionHandler context. Make the documented example copy-pastable for Scala 2 by keeping myExceptionHandler within MyApp, then verify that the example compiles.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.