buildo/metarpheus

MatchError while parsing a router

Closed this issue · 1 comments

gabro commented

description

Morpheus crashes while parsing a route definition

Here's the stack trace

[error] (run-main-0) scala.MatchError: pathPrefix("auth") {
[error]       (get & path("test" / Segment) /**
[error]         get test resource
[error]         @param foo a test parameter that will be returned
[error]       */) (returns[Test].ctrl(authenticationController.test _))
[error]     } (of class scala.meta.internal.ast.Term$Apply$Impl)
scala.MatchError: pathPrefix("auth") {
      (get & path("test" / Segment) /**
        get test resource
        @param foo a test parameter that will be returned
      */) (returns[Test].ctrl(authenticationController.test _))
    } (of class scala.meta.internal.ast.Term$Apply$Impl)
        at morpheus.extractors.route.package$.extractRouteTerms(route.scala:78)
        at morpheus.extractors.route.package$.extractAllRoutes(route.scala:286)
        at morpheus.extractors.package$$anonfun$2.apply(extractors.scala:16)
        at morpheus.extractors.package$$anonfun$2.apply(extractors.scala:16)
        at scala.collection.immutable.List.flatMap(List.scala:327)
        at morpheus.extractors.package$.extractFullAPI(extractors.scala:16)
        at morpheus.main$.main(main.scala:31)
        at morpheus.main.main(main.scala)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)

and here's the route definition

@publishRoute
override val route =
  pathPrefix("auth") {
    (get & path("test" / Segment) /**
      get test resource
      @param foo a test parameter that will be returned
    */) (returns[Test].ctrl(authenticationController.test _))
  }
}
gabro commented

Got it. The issue is the absence of a block around pathPrefix. Fixed in #20