From d5533816c61f1c16f0a0d899156c85f300bd4350 Mon Sep 17 00:00:00 2001 From: Ilya Oskin Date: Mon, 7 Nov 2022 09:48:14 +0300 Subject: [PATCH] Catch all unexpected errors from token parser. (#247) --- build.sbt | 2 +- .../org/ergoplatform/explorer/protocol/TokenPropsParser.scala | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build.sbt b/build.sbt index 3b2b4863d..357aa9cf0 100644 --- a/build.sbt +++ b/build.sbt @@ -2,7 +2,7 @@ lazy val commonSettings = Seq( scalacOptions ++= commonScalacOptions, scalaVersion := "2.12.15", organization := "org.ergoplatform", - version := "9.17.3", + version := "9.17.4", resolvers += Resolver.sonatypeRepo("public"), resolvers += Resolver.sonatypeRepo("snapshots"), libraryDependencies ++= dependencies.Testing ++ dependencies.CompilerPlugins, diff --git a/modules/explorer-core/src/main/scala/org/ergoplatform/explorer/protocol/TokenPropsParser.scala b/modules/explorer-core/src/main/scala/org/ergoplatform/explorer/protocol/TokenPropsParser.scala index ac7c835a9..5c2384dae 100644 --- a/modules/explorer-core/src/main/scala/org/ergoplatform/explorer/protocol/TokenPropsParser.scala +++ b/modules/explorer-core/src/main/scala/org/ergoplatform/explorer/protocol/TokenPropsParser.scala @@ -23,7 +23,7 @@ object TokenPropsParser { new TokenPropsParser[TokenPropsEip4] { private val p = RegistersParser[Either[Throwable, *]] - def parse(registers: Map[RegisterId, HexString]): Option[TokenPropsEip4] = { + def parse(registers: Map[RegisterId, HexString]): Option[TokenPropsEip4] = Try { def parse(raw: HexString) = p.parse[SCollection[SByte.type]](raw).toOption val r4 = registers.get(RegisterId.R4) val r5 = registers.get(RegisterId.R5) @@ -39,7 +39,7 @@ object TokenPropsParser { val (description, decimals) = (descriptionOpt.getOrElse(""), decimalsOpt.getOrElse(0)) TokenPropsEip4(name, description, decimals) } - } + }.toOption.flatten } private def looksLikeUTF8(utf8: Array[Byte]): Boolean = {