Skip to content

Commit

Permalink
fix: mainnet rpc curve err (#597)
Browse files Browse the repository at this point in the history
  • Loading branch information
BobTheBuidler authored Sep 6, 2023
1 parent d5b92bb commit 642ad3d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions yearn/apy/curve/simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
import logging
import os
from dataclasses import dataclass
from decimal import Decimal
from pprint import pformat
from functools import lru_cache

from time import time
from http import HTTPStatus

import requests
from brownie import ZERO_ADDRESS, chain, interface
Expand Down Expand Up @@ -104,7 +104,13 @@ def get_gauge_relative_weight_for_sidechain(gauge_address):
}
headers = {'Content-type': 'application/json'}
res = requests.post(url, data=json.dumps(payload), headers=headers)
result = res.json()
try:
result = res.json()
except json.JSONDecodeError:
try:
raise ApyError("crv:simple", f"mainnet rpc returned bad response {HTTPStatus(res.status_code)} {res.text}")
except ValueError:
raise ApyError("crv:simple", f"mainnet rpc returned bad response code {res.status_code} {res.text}")
return int(result["result"], 16)


Expand Down

0 comments on commit 642ad3d

Please sign in to comment.