diff options
author | Jakob Odersky <jakob@odersky.com> | 2017-07-14 15:25:38 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-14 15:25:38 -0700 |
commit | dd9e22ac2e085505e2b6a1ca476fe1dcdc7e8618 (patch) | |
tree | da106c15b9402f3f6f9f19f92fe2a2258d5cf7d3 /src/main/scala/xyz/driver/pdsuicommon/error/ErrorCode.scala | |
parent | 3d902b5197db861c30325c159dc10cfb211ae209 (diff) | |
parent | d733294cb16fa83be014ce1efccbf364aa309d25 (diff) | |
download | rest-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.scala | 17 |
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) + +} |