Skip to content

Commit

Permalink
Raise error on missing api token
Browse files Browse the repository at this point in the history
  • Loading branch information
Scarvy committed Mar 17, 2024
1 parent 7feb06b commit 2a3a1f2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion readwise_to_apple_notes/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@

load_dotenv()

client = Readwise(os.environ["READWISE_TOKEN"])
try:
client = Readwise(os.environ["READWISE_TOKEN"])
except KeyError:
raise EnvironmentError(
"READWISE_TOKEN environment variable is not set.",
"Please set it before continuing or place it in a .env file.",
)


def get_books():
Expand Down

0 comments on commit 2a3a1f2

Please sign in to comment.