forked from SaltwaterC/aws2js
-
Notifications
You must be signed in to change notification settings - Fork 0
Throwing Error()s
SaltwaterC edited this page Feb 10, 2012
·
14 revisions
The aws2js module tries to avoid throwing errors. Instead it chooses to report the errors as the error argument of the callback argument of a specific method. However, it throws errors when there is an user error which can't be recovered without actual human intervention.
The situations:
- Lack of client.setCredentials() call before making a remote request or lack of passed credentials to the aws.load().
- query.setRegion() throws an Error() if the specified region is invalid. Implementing a callback argument brings little benefit besides adding yet another callback in your chain. Since the values are fixed, you may hardcode your own map or something like this. This error is thrown only when you fat finger the region name.
- the client loader, aws.load(), throws an Error() if you specify an invalid client name. Implementing a callback here would be the stupidest thing ever. Without a properly returned client this module does basically nothing. As the previous case, the clients have a fixed name. This Error() is thrown if you fat finger their name.
- query.setApiVersion() throws an Error() if you specify a syntactically broken query API version number. Obviously, this happens only when you fat finger the string indicating the version.
- If you use a broken Response Body Handler.
- If you use a broken Request Body Handler.
- If you use an invalid SQS queue path when calling sqs.setQueue().
- If you don't pass a session token argument for dynamodb.setCredentials().
- If you try to load the S3 client under node.js v0.6.9. Use up to 0.6.8 or 0.6.10. Reason: #2636.