No more blind except

This commit is contained in:
kdeme 2019-12-04 13:43:18 +01:00
parent 9964a55772
commit 9aae2f9463
2 changed files with 9 additions and 9 deletions

View File

@ -209,7 +209,7 @@ proc processInteger*(v: string, o: var int): ConfigStatus =
try: try:
o = parseInt(v) o = parseInt(v)
result = Success result = Success
except: except ValueError:
result = ErrorParseOption result = ErrorParseOption
proc processFloat*(v: string, o: var float): ConfigStatus = proc processFloat*(v: string, o: var float): ConfigStatus =
@ -217,7 +217,7 @@ proc processFloat*(v: string, o: var float): ConfigStatus =
try: try:
o = parseFloat(v) o = parseFloat(v)
result = Success result = Success
except: except ValueError:
result = ErrorParseOption result = ErrorParseOption
proc processAddressPortsList(v: string, proc processAddressPortsList(v: string,
@ -230,11 +230,11 @@ proc processAddressPortsList(v: string,
var tas6: seq[TransportAddress] var tas6: seq[TransportAddress]
try: try:
tas4 = resolveTAddress(item, IpAddressFamily.IPv4) tas4 = resolveTAddress(item, IpAddressFamily.IPv4)
except: except CatchableError:
discard discard
try: try:
tas6 = resolveTAddress(item, IpAddressFamily.IPv6) tas6 = resolveTAddress(item, IpAddressFamily.IPv6)
except: except CatchableError:
discard discard
if len(tas4) == 0 and len(tas6) == 0: if len(tas4) == 0 and len(tas6) == 0:
result = ErrorParseOption result = ErrorParseOption
@ -296,7 +296,7 @@ proc processPrivateKey(v: string, o: var PrivateKey): ConfigStatus =
try: try:
o = initPrivateKey(v) o = initPrivateKey(v)
result = Success result = Success
except: except CatchableError:
result = ErrorParseOption result = ErrorParseOption
# proc processHexBytes(v: string, o: var seq[byte]): ConfigStatus = # proc processHexBytes(v: string, o: var seq[byte]): ConfigStatus =
@ -304,7 +304,7 @@ proc processPrivateKey(v: string, o: var PrivateKey): ConfigStatus =
# try: # try:
# o = fromHex(v) # o = fromHex(v)
# result = Success # result = Success
# except: # except CatchableError:
# result = ErrorParseOption # result = ErrorParseOption
# proc processHexString(v: string, o: var string): ConfigStatus = # proc processHexString(v: string, o: var string): ConfigStatus =
@ -312,7 +312,7 @@ proc processPrivateKey(v: string, o: var PrivateKey): ConfigStatus =
# try: # try:
# o = parseHexStr(v) # o = parseHexStr(v)
# result = Success # result = Success
# except: # except CatchableError:
# result = ErrorParseOption # result = ErrorParseOption
# proc processJson(v: string, o: var JsonNode): ConfigStatus = # proc processJson(v: string, o: var JsonNode): ConfigStatus =
@ -320,7 +320,7 @@ proc processPrivateKey(v: string, o: var PrivateKey): ConfigStatus =
# try: # try:
# o = parseJson(v) # o = parseJson(v)
# result = Success # result = Success
# except: # except CatchableError:
# result = ErrorParseOption # result = ErrorParseOption
proc processPruneList(v: string, flags: var PruneMode): ConfigStatus = proc processPruneList(v: string, flags: var PruneMode): ConfigStatus =

View File

@ -59,7 +59,7 @@ proc setupWhisperRPC*(node: EthereumNode, keys: WhisperKeys, rpcsrv: RpcServer)
# this is the general behaviour we want. # this is the general behaviour we want.
try: try:
waitFor node.setPowRequirement(pow) waitFor node.setPowRequirement(pow)
except: except CatchableError:
trace "setPowRequirement error occured" trace "setPowRequirement error occured"
result = true result = true