Skip to content

Add faraday and curl's errors in PDC::Error - #54

Open
xiangge wants to merge 1 commit into
product-definition-center:masterfrom
xiangge:improve-raise-error
Open

Add faraday and curl's errors in PDC::Error#54
xiangge wants to merge 1 commit into
product-definition-center:masterfrom
xiangge:improve-raise-error

Conversation

@xiangge

@xiangge xiangge commented Feb 28, 2018

Copy link
Copy Markdown

Add faraday and curl's errors in PDC::Error
JIRA: PDC-1845

@coveralls

coveralls commented Feb 28, 2018

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.3%) to 98.616% when pulling 212330d on xiangge:improve-raise-error into ae37070 on product-definition-center:master.

@xiangge
xiangge force-pushed the improve-raise-error branch from d929ecf to 678ae6d Compare March 1, 2018 07:33
@xiangge
xiangge requested a review from sthaha March 1, 2018 07:34
Comment thread lib/pdc/errors.rb Outdated
@@ -1,8 +1,38 @@
# require 'curb'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you want to delete this?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, thanks.

@sthaha sthaha left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the patch but some comments that are worth addressing. And please don't forget tests :-)

Comment thread lib/pdc/resource/relation.rb Outdated
raise PDC::ConnectionFailed.new e
rescue Curl::Err::HostResolutionError => e
raise PDC::HostResolutionError.new e
rescue Curl::Err::CurlError => e

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't want a CurlError since it is leaking the details of the implmentation outside, think how the users code will have to change if we replace curl with something else. Curl and Faraday are implementation details of the gem that users shouldn't care about.

How about we return PDC::Error if it is a CurlError

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have changed this part, and also keep the PDC's errors raise as the original way, just wrap the non pdc errors, user can use a PDC:Error to catch it.

@xiangge
xiangge force-pushed the improve-raise-error branch 3 times, most recently from d76ef59 to 792d37e Compare March 5, 2018 11:09
@xiangge

xiangge commented Mar 5, 2018

Copy link
Copy Markdown
Author

@sthaha the gemfile changes will push with pr #55, will rebase it after the pr is approved.

@xiangge

xiangge commented Mar 8, 2018

Copy link
Copy Markdown
Author

@sthaha any updates about my new changes :)?

@xiangge
xiangge requested review from simonbaird and simozhan March 12, 2018 12:11
@xiangge

xiangge commented Mar 12, 2018

Copy link
Copy Markdown
Author

@simonbaird and @simozhan please help to review this patch, after it merged, I will change the et's related codes.

@xiangge

xiangge commented Mar 13, 2018

Copy link
Copy Markdown
Author

After look at the et's codes, I found there are more changes needed here.

@xiangge
xiangge force-pushed the improve-raise-error branch from 792d37e to a05616a Compare March 16, 2018 01:06
Add faraday and curl's errors in PDC::Error
JIRA: PDC-1845
@xiangge
xiangge force-pushed the improve-raise-error branch from a05616a to 212330d Compare March 16, 2018 05:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants