Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
VideoLAN
VLC-iOS
Commits
1b1116c9
Commit
1b1116c9
authored
Jun 16, 2013
by
Felix Paul Kühne
Browse files
VLCHTTPFileDownloader: improve error reporting
parent
a702fdf0
Changes
2
Hide whitespace changes
Inline
Side-by-side
AspenProject/VLCHTTPFileDownloader.h
View file @
1b1116c9
...
...
@@ -14,7 +14,7 @@
-
(
void
)
downloadEnded
;
@optional
-
(
void
)
downloadFailedWithError
:(
NSError
*
)
error
;
-
(
void
)
downloadFailedWithError
Description
:(
NSString
*
)
description
;
-
(
void
)
progressUpdatedTo
:(
CGFloat
)
percentage
;
@end
...
...
AspenProject/VLCHTTPFileDownloader.m
View file @
1b1116c9
...
...
@@ -55,6 +55,10 @@
_expectedDownloadSize
=
[
response
expectedContentLength
];
[
self
.
delegate
downloadStarted
];
APLog
(
@"expected download size: %i"
,
_expectedDownloadSize
);
}
else
{
APLog
(
@"unhandled status code %i"
,
statusCode
);
if
([
self
.
delegate
respondsToSelector
:
@selector
(
downloadFailedWithErrorDescription
:)])
[
self
.
delegate
downloadFailedWithErrorDescription
:[
NSString
stringWithFormat
:
@"Download failed with HTTP code %i"
,
statusCode
]];
}
}
...
...
@@ -68,8 +72,8 @@
if
(
!
fileHandle
)
{
APLog
(
@"file creation failed, no data was saved"
);
if
([
self
.
delegate
respondsToSelector
:
@selector
(
downloadFailedWithError
:)])
[
self
.
delegate
downloadFailedWithError
:
nil
];
if
([
self
.
delegate
respondsToSelector
:
@selector
(
downloadFailedWithError
Description
:)])
[
self
.
delegate
downloadFailedWithError
Description
:
@"File creation failed"
];
return
;
}
}
...
...
@@ -105,8 +109,8 @@
_downloadInProgress
=
NO
;
[
UIApplication
sharedApplication
].
networkActivityIndicatorVisible
=
NO
;
if
([
self
.
delegate
respondsToSelector
:
@selector
(
downloadFailedWithError
:)])
[
self
.
delegate
downloadFailedWithError
:
error
];
if
([
self
.
delegate
respondsToSelector
:
@selector
(
downloadFailedWithError
Description
:)])
[
self
.
delegate
downloadFailedWithError
Description
:
error
.
description
];
[
self
.
delegate
downloadEnded
];
}
...
...
@@ -114,6 +118,10 @@
-
(
void
)
cancelDownload
{
[
_urlConnection
cancel
];
if
([
self
.
delegate
respondsToSelector
:
@selector
(
downloadFailedWithErrorDescription
:)])
[
self
.
delegate
downloadFailedWithErrorDescription
:
@"Download canceled by user"
];
[
self
.
delegate
downloadEnded
];
}
@end
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment