Skip to content
Permalink
Browse files

Updated error support in Scala.js

  • Loading branch information...
darkfrog26 committed Jul 17, 2018
1 parent dd723c4 commit d7cc96b18421f2b94d33971f5beebe02c307a4e7
Showing with 8 additions and 2 deletions.
  1. +1 −0 README.md
  2. +7 −2 app/js/src/main/scala/io/youi/app/ClientApplication.scala
@@ -7,6 +7,7 @@
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/outr/youi)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.youi/youi-core_2.12/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.youi/youi-core_2.12)
[![Latest version](https://index.scala-lang.org/outr/youi/youi-core/latest.svg)](https://index.scala-lang.org/outr/youi)
[![Javadocs](https://javadoc.io/badge/io.youi/youi-core_2.12.svg)](https://javadoc.io/doc/io.youi/youi-core_2.12)

Next generation user interface and application development in Scala and Scala.js for web, mobile, and desktop.

@@ -14,6 +14,7 @@ import scribe.writer.Writer
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.Future
import scala.scalajs.js
import scala.scalajs.js.|

trait ClientApplication extends YouIApplication with ScreenManager {
ClientApplication.instance = this
@@ -25,8 +26,12 @@ trait ClientApplication extends YouIApplication with ScreenManager {

def clientConnectivity(connectivity: ApplicationConnectivity): ClientConnectivity = configuredConnectivity(connectivity)

private val errorFunction: js.Function5[String, String, Int, Int, Throwable, Unit] = (message: String, source: String, line: Int, column: Int, throwable: Throwable) => {
ErrorTrace.toError(message, source, line, column, Option(throwable)).map(ClientApplication.sendError)
private val errorFunction: js.Function5[String, String, Int, Int, Throwable | js.Error, Unit] = (message: String, source: String, line: Int, column: Int, err: Throwable | js.Error) => {
err match {
case null => ErrorTrace.toError(message, source, line, column, None).map(ClientApplication.sendError)
case t: Throwable => ErrorTrace.toError(message, source, line, column, Some(t)).map(ClientApplication.sendError)
case e: js.Error => ErrorTrace.toError(message, source, line, column, Some(js.JavaScriptException(e))).map(ClientApplication.sendError)
}
()
}

0 comments on commit d7cc96b

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.