Skip to content

Commit

Permalink
Merge pull request #1862 from lift/msf_issue_930
Browse files Browse the repository at this point in the history
Use a custom implicitNotFound error for CSS transforms

This adds a custom error message that provides a bit more direction
when we can't find an implicit converter for a CSS transform. Tested it
out by creating an error in a spec... it looks like this!

    [error] ...: The value you're attempting to use on the right hand side of
       the #> operator can't be automatically converted to a (NodeSeq)=>NodeSeq
       function. Consider binding the individual members of the class you're trying to
       use, or define an implicit CanBind[T] that tells Lift how to convert this to a
       (NodeSeq)=>NodeSeq.
    [error]       ".foo" #> Bacon("boo!")
    [error]              ^
    [error] one error found
  • Loading branch information
Shadowfiend authored Jun 13, 2017
2 parents ed5ff17 + 1ba4cf5 commit dc74f8d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions core/util/src/main/scala/net/liftweb/util/CssSel.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package util
import common._
import xml._
import collection.mutable.ListBuffer
import scala.annotation.implicitNotFound

/**
* Created with IntelliJ IDEA.
Expand Down Expand Up @@ -753,6 +754,7 @@ final class CssJBridge extends CssBindImplicits {

}

@implicitNotFound("The value you're attempting to use on the right hand side of the #> operator can't be automatically converted to a (NodeSeq)=>NodeSeq function. Consider binding the individual members of the class you're trying to use, or define an implicit CanBind[T] that tells Lift how to convert this to a (NodeSeq)=>NodeSeq.")
trait CanBind[-T] {
def apply(it: => T)(ns: NodeSeq): Seq[NodeSeq]
}
Expand Down

0 comments on commit dc74f8d

Please sign in to comment.