Skip to content

Commit

Permalink
Xero credential does not exist sentry error resolved (#229)
Browse files Browse the repository at this point in the history
* Xero credential does not exist sentry error added

* Platform error added

* Platform error added

* Pytest updated

* Pytest resolved
  • Loading branch information
ruuushhh authored Apr 24, 2023
1 parent ee018b2 commit 9c892df
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
run: |
docker-compose -f docker-compose-pipeline.yml build
docker-compose -f docker-compose-pipeline.yml up -d
docker-compose -f docker-compose-pipeline.yml exec -T api pytest tests/ --cov=. --cov-report=xml --cov-fail-under=97 --junit-xml=test-reports/report.xml
docker-compose -f docker-compose-pipeline.yml exec -T api pytest tests/ --cov=. --cov-report=xml --cov-fail-under=97 --junit-xml=test-reports/report.xml | tee pytest-coverage.txt
echo "STATUS=$(cat pytest-coverage.txt | grep 'Required test' | awk '{ print $1 }')" >> $GITHUB_ENV
echo "FAILED=$(cat test-reports/report.xml | awk -F'=' '{print $5}' | awk -F' ' '{gsub(/"/, "", $1); print $1}')" >> $GITHUB_ENV
env:
Expand Down
8 changes: 7 additions & 1 deletion apps/mappings/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

from fyle_accounting_mappings.models import Mapping, MappingSetting, DestinationAttribute, ExpenseAttribute

from fyle.platform.exceptions import WrongParamsError, InternalServerError, InvalidTokenError as FyleInvalidTokenError
from fyle.platform.exceptions import WrongParamsError, InternalServerError, InvalidTokenError as FyleInvalidTokenError, PlatformError

from xerosdk.exceptions import UnsuccessfulAuthentication, InvalidGrant

Expand Down Expand Up @@ -178,6 +178,12 @@ def auto_create_category_mappings(workspace_id):
except InternalServerError:
logger.error('Internal server error while importing to Fyle')

except PlatformError as exception:
logger.error(
'Platform error - %s in Fyle %s %s',
workspace_id, exception.message, {'error': exception.response}
)

except Exception:
error = traceback.format_exc()
error = {
Expand Down
2 changes: 2 additions & 0 deletions apps/xero/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,8 @@ def create_chain_and_export(chaining_attributes: list, workspace_id: int) -> Non

except UnsuccessfulAuthentication:
logger.info('Xero refresh token is invalid for workspace_id - %s', workspace_id)
except XeroCredentials.DoesNotExist:
logger.info('Xero Credentials not found for workspace_id %s',workspace_id)

def schedule_bills_creation(workspace_id: int, expense_group_ids: List[str]) -> list:
"""
Expand Down

0 comments on commit 9c892df

Please sign in to comment.