Created
March 2, 2017 13:27
-
-
Save hongwei1/eaff5cd0a73eae7245437f43eb1932d5 to your computer and use it in GitHub Desktop.
exception
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import net.liftweb.common.{Box, Empty, Failure, Full} | |
import net.liftweb.util.Helpers.tryo | |
//val option: Option[Null] = Option(null) | |
val box1 = Full(null) | |
val box2 = Full("") | |
val box3 = Empty | |
val box4 = None | |
val box5 = Failure("hongwei") | |
box3.isEmpty | |
val option1: Option[Null] = Option(null) | |
val option2 = Empty | |
option1.isEmpty | |
option2.isEmpty | |
val full = Full {new RuntimeException("123")} | |
full.get | |
//1/0 | |
1 Empty--> error message | |
isgoodtest <- Empty ?~ ErrorMessages.InvalidJsonFormat ---> Failture(OBP-10001: Incorrect json format.") ----> "error": "OBP-10001: Incorrect json format." | |
the same as: | |
isgoodtest <- Failure(ErrorMessages.InvalidJsonFormat) ---> Failture(OBP-10001: Incorrect json format.") ----> "error": "OBP-10001: Incorrect json format." | |
2 Empty --> correct | |
isgoodtest <- tryo{Empty} ?~ ErrorMessages.InvalidJsonFormat ----> correct | |
same as : | |
isgoodtest <- Full(Empty) ?~ ErrorMessages.InvalidJsonFormat ----> correct | |
3 Exception ->error message | |
isgoodtest <- tryo {1/0} ?~ ErrorMessages.InvalidJsonFormat ---> Failture(OBP-10001: Incorrect json format.") ----> "error": "OBP-10001: Incorrect json format." | |
4 Exception -->Exception | |
isgoodtest <- Full(1/0) ?~ ErrorMessages.InvalidJsonFormat ---> Exception, not clear message |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment