Skip to content
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

Improve error handling in NativeShare->get #41

Merged
merged 4 commits into from
Jan 20, 2016
Merged

Conversation

icewind1991
Copy link
Owner

Handle things like invalid paths or invalid streams.

cc @PVince81

$this->connect();
$sourceHandle = $this->state->open($this->buildUrl($source), 'r');
$targetHandle = fopen($target, 'wb');
if (!$sourceHandle) {
fclose($targetHandle);

Choose a reason for hiding this comment

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

do you have a test for this case ?

Copy link
Owner Author

Choose a reason for hiding this comment

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

Not if there is a way to trigger that case without getting an exception from state->open already, have it in just in case

@PVince81
Copy link

Code looks good, I haven't tested it 👍

icewind1991 added a commit that referenced this pull request Jan 20, 2016
Improve error handling in NativeShare->get
@icewind1991 icewind1991 merged commit acb94a0 into master Jan 20, 2016
@icewind1991 icewind1991 deleted the invalid-handle branch January 20, 2016 13:12
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.

2 participants