Skip to content

Commit

Permalink
Added RetryException handler and bumped the sdk versions (#96)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hrishabh17 authored Feb 14, 2024
1 parent 7cf6a75 commit bd9716a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
8 changes: 7 additions & 1 deletion apps/fyle/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import traceback
from functools import wraps

from fyle.platform.exceptions import NoPrivilegeError
from fyle.platform.exceptions import NoPrivilegeError, RetryException

from apps.workspaces.models import FyleCredential

Expand All @@ -27,6 +27,12 @@ def wrapper(*args, **kwargs):
args[1].status = 'FAILED'
args[1].save()

except RetryException:
logger.info('Fyle Retry Exception occured')
args[1].detail = {'message': 'Fyle Retry Exception occured'}
args[1].status = 'FATAL'
args[1].save()

except Exception:
error = traceback.format_exc()
args[1].detail = {'error': error}
Expand Down
6 changes: 5 additions & 1 deletion apps/mappings/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from dynamics.exceptions.dynamics_exceptions import InvalidTokenError
from fyle.platform.exceptions import InternalServerError
from fyle.platform.exceptions import InvalidTokenError as FyleInvalidTokenError
from fyle.platform.exceptions import WrongParamsError
from fyle.platform.exceptions import WrongParamsError, RetryException

from apps.mappings.models import ImportLog
from apps.workspaces.models import BusinessCentralCredentials
Expand Down Expand Up @@ -42,6 +42,10 @@ def new_fn(expense_attribute_instance, *args):
error['alert'] = False
import_log.status = 'FAILED'

except RetryException:
error['message'] = 'Fyle Retry Exception occured'
import_log.status = 'FATAL'

except InternalServerError:
error['message'] = 'Internal server error while importing to Fyle'
error['alert'] = True
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ gevent==23.9.1
gunicorn==20.1.0

# Platform SDK
fyle==0.36.0
fyle==0.36.1

# Business central sdk
ms-dynamics-business-central-sdk==1.4.2

# Reusable Fyle Packages
fyle-rest-auth==1.6.0
fyle-accounting-mappings==1.29.2
fyle-integrations-platform-connector==1.36.1
fyle-integrations-platform-connector==1.36.3

# Postgres Dependincies
psycopg2-binary==2.9.9
Expand Down

0 comments on commit bd9716a

Please sign in to comment.