From def4bd990a5524ed86885977648cc3218af440e6 Mon Sep 17 00:00:00 2001 From: jeffyanta Date: Mon, 19 Jan 2026 13:30:40 -0500 Subject: [PATCH] Improve GetHistoricalMintData error handling for exchange rate or reserve not found errors --- ocp/rpc/currency/server.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/ocp/rpc/currency/server.go b/ocp/rpc/currency/server.go index dd7ebc7..702e20e 100644 --- a/ocp/rpc/currency/server.go +++ b/ocp/rpc/currency/server.go @@ -255,7 +255,11 @@ func (s *currencyServer) GetHistoricalMintData(ctx context.Context, req *currenc endTime, interval, ) - if err != nil { + if err == currency.ErrNotFound { + return ¤cypb.GetHistoricalMintDataResponse{ + Result: currencypb.GetHistoricalMintDataResponse_MISSING_DATA, + }, nil + } else if err != nil { log.With(zap.Error(err)).Warn("failed to load currency reserve history") return nil, status.Error(codes.Internal, "") } @@ -275,7 +279,11 @@ func (s *currencyServer) GetHistoricalMintData(ctx context.Context, req *currenc endTime, interval, ) - if err != nil { + if err == currency.ErrNotFound { + return ¤cypb.GetHistoricalMintDataResponse{ + Result: currencypb.GetHistoricalMintDataResponse_MISSING_DATA, + }, nil + } else if err != nil { log.With(zap.Error(err)).Warn("failed to load exchange rate history") return nil, status.Error(codes.Internal, "") }