Alexis Hernandez
7 years ago
2 changed files with 27 additions and 0 deletions
@ -0,0 +1,24 @@ |
|||||
|
package com.xsn.explorer.errors |
||||
|
|
||||
|
import com.alexitc.playsonify.models.{FieldValidationError, InputValidationError, PublicError} |
||||
|
import play.api.i18n.{Lang, MessagesApi} |
||||
|
|
||||
|
sealed trait TransactionError |
||||
|
|
||||
|
case object TransactionFormatError extends TransactionError with InputValidationError { |
||||
|
|
||||
|
override def toPublicErrorList(messagesApi: MessagesApi)(implicit lang: Lang): List[PublicError] = { |
||||
|
val message = messagesApi("error.transaction.format") |
||||
|
val error = FieldValidationError("transactionId", message) |
||||
|
List(error) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
case object TransactionNotFoundError extends TransactionError with InputValidationError { |
||||
|
|
||||
|
override def toPublicErrorList(messagesApi: MessagesApi)(implicit lang: Lang): List[PublicError] = { |
||||
|
val message = messagesApi("error.transaction.notFound") |
||||
|
val error = FieldValidationError("transactionId", message) |
||||
|
List(error) |
||||
|
} |
||||
|
} |
@ -1,3 +1,6 @@ |
|||||
# https://www.playframework.com/documentation/latest/ScalaI18N |
# https://www.playframework.com/documentation/latest/ScalaI18N |
||||
|
|
||||
xsn.server.unexpectedError=Unexpected error from the XSN network |
xsn.server.unexpectedError=Unexpected error from the XSN network |
||||
|
|
||||
|
error.transaction.format=Invalid transaction format |
||||
|
error.transaction.notFound=Transaction not found |
||||
|
Loading…
Reference in new issue