-
Notifications
You must be signed in to change notification settings - Fork 131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting the exception on failure #105
Comments
I prefer to follow the interface. But let's see how we can resolve your issue. What are the particular errors that you are trying to catch? |
@baopham - a similar issue came up with a Cognito package I’m contributing too, we ended up making it a config option. Default swallowed the exception and returned true/false and another option allowed it to throw the exception, a third option introduced an error handler. We could maybe look into this as an option for dynamodb? |
Yep good idea @zoul0813 // dynamodb.php config
return [
...,
// If empty, default to swallow
// If want to throw, pass in the provided BaoPham\DynamoDb\ErrorHandlers\RaiseError::class
// If want to handle errors directly, pass in a custom class
'error_handler' => App\CustomDynamoDbErrorHandler::class
]; The above might mean that the custom error handler won't have much context of which method of which class that causes the error though. It'd be better if we know more about your use case @hasyimibhar |
@baopham I'm saving something to DynamoDb from a queued job. I usually let unexpected exception pass through and halt the job, and I'll get notified (via email, Slack, etc.) of exactly why my job failed. If there is a way to get the underlying exception when |
ok, after thinking about it, I think we don't have to catch all exception like how it is right now. Thanks for reporting this, will work on it. |
Done. Please use v3.0.0 |
Is there a way to get the exception from the underlying client? Currently the exception is logged and
false
is returned.I think it would be better to let the exception pass through and let the caller handle it himself, even though it partially violates the interface of the
save
method.The text was updated successfully, but these errors were encountered: