Skip to content

Commit

Permalink
Merge pull request #158 from diogomatoschaves/add-error-handling
Browse files Browse the repository at this point in the history
Add error handling case
  • Loading branch information
diogomatoschaves authored Feb 23, 2024
2 parents 7994378 + ac46377 commit b5b3100
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions INSTALLATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ BINANCE_API_SECRET_TEST # Your personal Binance API secret (binance testnet)
USE_CLOUD_STORAGE # Either true or false - tells the app whether to use a cloud storage
AWS_ACCESS_KEY_ID # Your Personal AWS access key
AWS_SECRET_ACCESS_KEY # Your Personal AWS secret access key
AWS_BUCKET # The name of the bucket where you'll keep you files
AWS_BUCKET # The name of the S3 bucket where you'll keep your files
```

*Note: The remote cloud storage ones (AWS) are only required to be set if you want to have that option enabled for local usage.
Expand All @@ -46,7 +46,7 @@ The database is handled by a postgres docker container as a service, which ensur
from local installations. When the database service is up, the database can be accessed on the local server on
the port `5433`, instead of the usual `5432`.

In order to setup the database we need to start the services in detached mode via `docker-compose`, as follows:
In order to set up the database we need to start the services in detached mode via `docker-compose`, as follows:

$ docker-compose up -d --build

Expand Down
5 changes: 3 additions & 2 deletions model/service/cloud_storage/_cloud_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import os

import boto3
from botocore.exceptions import ClientError, NoCredentialsError
from botocore.exceptions import ClientError, NoCredentialsError, ParamValidationError

from dotenv import load_dotenv, find_dotenv

Expand Down Expand Up @@ -40,12 +40,13 @@ def check_aws_config():
try:
s3.list_objects(Bucket=bucket)
return True
except ClientError:
except (ClientError, ParamValidationError):
logging.warning(f"Bucket {bucket} does not exist. AWS_BUCKET must be set.")
return False
except NoCredentialsError:
logging.warning(f"The provided credentials are wrong. "
f"AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY must be set.")
return False


def upload_models(local_models_dir):
Expand Down

0 comments on commit b5b3100

Please sign in to comment.