question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issues related to use of TransportException

See original GitHub issue

Lagom Version (2.5.x / etc)

Lagom 1.3.0-RC1

API (Scala / Java / Neither / Both)

Scala

There are several minor annoyances related to using TransportException, e.g. to return NotFound results. I’m happy to submit a PR with the appropriate changes if I can get some feedback about the most desirable approaches:

  • (#1247) The use of getClass in the TransportException constructor results in the ExceptionMessage name being set to "Predef$". This doesn’t affect the built-in exceptions since they explicitly pass classOf[X].getSimpleName as the name, but it affects subclasses of TransportException which use the default constructors, e.g. this test fails:
import com.lightbend.lagom.scaladsl.api.transport.{TransportErrorCode, TransportException}
import org.scalatest.WordSpec
class ResponseExceptionsSpec extends WordSpec {
  "TransportException" should {
      "not use Predef$ as the exception name" in {
        val e = new TransportException(TransportErrorCode.NotFound, "Not found")
        assert(e.exceptionMessage.name != "Predef$")
      }
   }
}
  • It is often not desirable to log a TransportException, e.g. ScaladslServiceRouter overrides maybeLogException to not log NotFound when a service call throws it. However, there is no way to extend this to an app’s own TransportException subclasses since LagomServerBuilder is final, and it always constructs a ScaladslServiceRouter. Possible solutions could be:

    • Provide an option to ignore all TransportExceptions (other than the ones being reported as warnings)
    • Introduce a marker trait which could indicate that the exception is not to be logged
    • Allow the router to be specified by the application so that maybeLogException can be overridden with custom logic.
  • (almost done in #1247) The built-in TransportExceptions don’t provide any tests for equality, so returning them from a PersistentEntity causes the PersistentEntityTestDriver to report that they are not the same before/after serialization/deserialization. E.g.

org.scalatest.exceptions.TestFailedException: Vector(Object [com.lightbend.lagom.scaladsl.api.transport.NotFound: not found (TransportErrorCodeImpl(404,1008,Policy Violation))] does not equal [com.lightbend.lagom.scaladsl.api.transport.NotFound: not found (TransportErrorCodeImpl(404,1008,Policy Violation))] after serialization/deserialization) had length 1 instead of expected length 0

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:5
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
steinybotcommented, Sep 10, 2018

#1247 doesn’t fix the third item. I think a TODO was left for this https://github.com/lagom/lagom/pull/1247/files#r173299260

0reactions
ignasi35commented, Mar 14, 2018

@notNotDaniel I edited the original description so your list is now a todo list. Also added a ref to the PR fixing the first item as @TimMoore pointed out.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Mailer] add error code to TransportException #45221 - GitHub
In our application it is a valid flow to get a 535, if the credentials in cache are not valid anymore -> we...
Read more >
Cannot execute request on any known server - Stack Overflow
When I simply run the code I see the following error comes. What is the issue ? com.netflix.discovery.shared.transport.TransportException: ...
Read more >
Transport Exception error received when accessing models
Solved: This item has been identified as an outstanding known issue. A workaround is provided until the issue is officially fixed.
Read more >
Unable to clone Git repositories using the Eclipse Git ... - IBM
Problem. Attempts to clone Git repositories using the Eclipse Git Team Provider in IBM Rational Application Developer results in a failure ...
Read more >
Azure eventhub giving transport exception in Java 11
Hi while using eventhub which is configured in IOT hubs message route getting issue while using java 11. However after using java 8(as ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found