Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
b7b7c381
Commit
b7b7c381
authored
May 13, 2016
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/Thread: catch exceptions
Allow decoders to throw std::runtime_error.
parent
995cd954
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
1 deletion
+21
-1
DecoderThread.cxx
src/decoder/DecoderThread.cxx
+21
-1
No files found.
src/decoder/DecoderThread.cxx
View file @
b7b7c381
...
...
@@ -39,6 +39,7 @@
#include "tag/ApeReplayGain.hxx"
#include "Log.hxx"
#include <stdexcept>
#include <functional>
#include <memory>
...
...
@@ -351,10 +352,29 @@ decoder_run_file(Decoder &decoder, const char *uri_utf8, Path path_fs)
*/
static
bool
DecoderUnlockedRunUri
(
Decoder
&
decoder
,
const
char
*
real_uri
,
Path
path_fs
)
{
try
{
return
!
path_fs
.
IsNull
()
?
decoder_run_file
(
decoder
,
real_uri
,
path_fs
)
:
decoder_run_stream
(
decoder
,
real_uri
);
}
catch
(
const
std
::
runtime_error
&
e
)
{
/* copy the exception to decoder.error */
if
(
decoder
.
error
.
IsDefined
())
{
/* decoder.error already set, now we have a second
one; only log the second one */
LogError
(
e
);
return
false
;
}
const
char
*
error_uri
=
real_uri
;
const
std
::
string
allocated
=
uri_remove_auth
(
error_uri
);
if
(
!
allocated
.
empty
())
error_uri
=
allocated
.
c_str
();
decoder
.
error
.
Format
(
decoder_domain
,
"Failed to decode %s: %s"
,
error_uri
,
e
.
what
());
return
false
;
}
/**
...
...
Write
Preview
Markdown
is supported
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