Skip to content

Commit

Permalink
Specifying the place of exception
Browse files Browse the repository at this point in the history
Specifying the place of exception
  • Loading branch information
gzukowski committed Jun 19, 2023
1 parent abe0483 commit 25bf3af
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion python/Auth0/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,6 @@ async def run(context, input):
run.data = json.dumps(config['request_data'])
asyncio.gather(get_auth(stream), return_exceptions=True)
except Exception as error:
print(error)
raise Exception(f"Config not loaded: {error}")
return
return stream.map(lambda x : x + '\n')
4 changes: 2 additions & 2 deletions python/Auth0/package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "@scramjet/stripe-read",
"name": "@scramjet/auth0-read",
"version": "0.1.0",
"main": "main.py",
"author": "gzukowski",
"license": "GPL-3.0",
"description": "Reading from stripe",
"description": "Reading from Auth0",
"keywords": [
"Stripe",
"Mailchimp",
Expand Down
14 changes: 9 additions & 5 deletions python/ChimpInsert/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,15 @@ async def insert_info(info):
print("No data received.")

async def run(context, input):
run.audience_id = context.config['audience_id']
mailchimp.set_config({
"api_key": context.config['mailchimp_api'],
"server": context.config['mailchimp_server'],
})
try:
run.audience_id = context.config['audience_id']
mailchimp.set_config({
"api_key": context.config['mailchimp_api'],
"server": context.config['mailchimp_server'],
})
except Exception as error:
raise Exception(f"Config not loaded: {error}")
return
return input.each(insert_info)


Expand Down
6 changes: 5 additions & 1 deletion python/Stripe/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ async def get_event(stream):


async def run(context, input):
stripe.api_key = context.config['stripe_api']
try:
stripe.api_key = context.config['stripe_api']
except Exception as error:
raise Exception(f"Config not loaded: {error}")
return
stream = Stream()
asyncio.gather(get_event(stream), return_exceptions=True)
return stream.map(lambda x : x + "\n")
Expand Down

0 comments on commit 25bf3af

Please sign in to comment.