aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/xyz/driver/pdsuicommon/error/ErrorCode.scala
diff options
context:
space:
mode:
authorJakob Odersky <jakob@odersky.com>2017-07-14 15:25:38 -0700
committerGitHub <noreply@github.com>2017-07-14 15:25:38 -0700
commitdd9e22ac2e085505e2b6a1ca476fe1dcdc7e8618 (patch)
treeda106c15b9402f3f6f9f19f92fe2a2258d5cf7d3 /src/main/scala/xyz/driver/pdsuicommon/error/ErrorCode.scala
parent3d902b5197db861c30325c159dc10cfb211ae209 (diff)
parentd733294cb16fa83be014ce1efccbf364aa309d25 (diff)
downloadrest-query-0.2.0.tar.gz
rest-query-0.2.0.tar.bz2
rest-query-0.2.0.zip
Merge pull request #7 from drivergroup/restification-tcv0.2.0
Implement trial curation rest services
Diffstat (limited to 'src/main/scala/xyz/driver/pdsuicommon/error/ErrorCode.scala')
-rw-r--r--src/main/scala/xyz/driver/pdsuicommon/error/ErrorCode.scala17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/main/scala/xyz/driver/pdsuicommon/error/ErrorCode.scala b/src/main/scala/xyz/driver/pdsuicommon/error/ErrorCode.scala
new file mode 100644
index 0000000..5574c01
--- /dev/null
+++ b/src/main/scala/xyz/driver/pdsuicommon/error/ErrorCode.scala
@@ -0,0 +1,17 @@
+package xyz.driver.pdsuicommon.error
+
+import play.api.libs.functional.syntax._
+import play.api.libs.json.{Format, Reads, Writes}
+
+@SuppressWarnings(Array("org.wartremover.warts.Enumeration"))
+object ErrorCode extends Enumeration {
+
+ type ErrorCode = Value
+ val Unspecified = Value(1)
+
+ private val fromJsonReads: Reads[ErrorCode] = Reads.of[Int].map(ErrorCode.apply)
+ private val toJsonWrites: Writes[ErrorCode] = Writes.of[Int].contramap(_.id)
+
+ implicit val jsonFormat: Format[ErrorCode] = Format(fromJsonReads, toJsonWrites)
+
+}