Skip to content

Commit

Permalink
Some more logging
Browse files Browse the repository at this point in the history
  • Loading branch information
emlowe committed Oct 30, 2023
1 parent c2d483b commit ba72fc3
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions app/api/v1/activities.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from typing import Dict, List, Optional

from pydantic import ValidationError
from fastapi import APIRouter, Depends
from fastapi.encoders import jsonable_encoder
from sqlalchemy.orm import Session
Expand Down Expand Up @@ -109,9 +109,20 @@ async def get_activity(
logger.warning(f"Got token: {token}")
org = unit.pop("organization", None)
project = unit.pop("project", None)

try:
token_on_chain = schemas.TokenOnChain(token)
logger.warning("instantiated TokenOnChain with __init__")
except ValidationError:
logger.warning("failed to instantiate TokenOnChain with __init__")
token_on_chain = schemas.TokenOnChain.parse_obj(token)
logger.warning("instantiated TokenOnChain with parse_obj")
except ValidationError:
logger.warning("failed to instantiate TokenOnChain with parse_obj")
raise

activity_with_cw = schemas.ActivityWithCW(
token=token,
token=token_on_chain,
cw_unit=unit,
cw_org=org,
cw_project=project,
Expand Down

0 comments on commit ba72fc3

Please sign in to comment.