Skip to content

Better Error Reporting #2801

@skukx

Description

@skukx

I'm not sure how the community feels about this but I would be willing to work on this myself if there is enough interest. Currently many of the Solidus errors are logged like so:

Rails.logger.error(<String>)

# Or

Rails.logger.error(e.message)

This is fine in a lot of cases, however in certain cases this is not optimal. The reason I say it isn't optimal is because stack trace is eliminated making it harder to debug. When using reporting services such as Rollbar it is nice to have those stack traces.

Non-Optimal Examples

image

image

image

Better Example

image

Summary

When ever we rescue an error we should call Rails.logger.error(error) or Rails.logger.warn(error). Here are some examples where this practice could be implemented.

rescue Spree::OrderMutex::LockFailed
flash[:error] = t('spree.order_mutex_error')
redirect_to spree.cart_path
end

rescue Spree::Core::GatewayError => e
flash[:error] = e.message.to_s
redirect_to new_admin_order_payment_path(@order)
end

rescue Spree::Core::GatewayError => e
flash[:error] = e.message.to_s
redirect_to new_admin_order_payment_path(@order)
end

Again this is nothing major but more of a quality of life change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions