Skip to content

Commit

Permalink
add some error handling and throw error if access key/secretkey not p…
Browse files Browse the repository at this point in the history
…assed in

Signed-off-by: Anuj Gakhar <anuj.gakhar@gmail.com>
  • Loading branch information
anujgakhar committed Nov 22, 2011
1 parent 38192b1 commit 7adb55a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -10,7 +10,7 @@ Pass in your auth credentials to the CFC's init() method and start using it.
ACCESS_KEY = "access_key";
SECRET_KEY = "secret_key";

objSes = createObject("com.anujgakhar.AmazonSES").init(
objSes = createObject("component","com.anujgakhar.AmazonSES").init(
accessKey="#ACCESS_KEY#",
secretKey="#SECRET_KEY#"
);
Expand Down
12 changes: 12 additions & 0 deletions com/anujgakhar/AmazonSES.cfc
Expand Up @@ -335,6 +335,18 @@ API Reference : http://docs.amazonwebservices.com/ses/latest/APIReference/
results.responseheader = {};
</cfscript>

<cfif not structKeyExists(variables.instance, "accessKey") or not len(trim(variables.instance.accessKey))>
<cfthrow message = "AccessKey not defined" type="com.anujgakhar.AmazonSES" />
</cfif>

<cfif not structKeyExists(variables.instance, "secretKey") or not len(trim(variables.instance.secretKey))>
<cfthrow message = "SecretKey not defined" type="com.anujgakhar.AmazonSES" />
</cfif>

<cfif not structKeyExists(variables.instance, "endPointUrl") or not len(trim(variables.instance.endPointUrl))>
<cfthrow message = "EndPointUrl not defined" type="com.anujgakhar.AmazonSES" />
</cfif>

<cfhttp method="#arguments.method#"
url="#variables.instance.endPointUrl#/"
charset="utf-8"
Expand Down

0 comments on commit 7adb55a

Please sign in to comment.