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
1c904000
Commit
1c904000
authored
Dec 27, 2015
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
command/Error: pass std::exception_ptr to PrintError()
Necessary to preserve type information. The try/catch sequence didn't work previously.
parent
672e18ca
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
8 deletions
+15
-8
AllCommands.cxx
src/command/AllCommands.cxx
+1
-1
CommandError.cxx
src/command/CommandError.cxx
+12
-5
CommandError.hxx
src/command/CommandError.hxx
+2
-2
No files found.
src/command/AllCommands.cxx
View file @
1c904000
...
...
@@ -418,6 +418,6 @@ try {
return
ret
;
}
catch
(
const
std
::
exception
&
e
)
{
Response
r
(
client
,
num
);
PrintError
(
r
,
e
);
PrintError
(
r
,
std
::
current_exception
()
);
return
CommandResult
::
ERROR
;
}
src/command/CommandError.cxx
View file @
1c904000
...
...
@@ -159,19 +159,26 @@ print_error(Response &r, const Error &error)
}
void
PrintError
(
Response
&
r
,
const
std
::
exception
&
e
)
PrintError
(
Response
&
r
,
std
::
exception_ptr
ep
)
{
LogError
(
e
);
try
{
std
::
rethrow_exception
(
ep
);
}
catch
(
const
std
::
exception
&
e
)
{
LogError
(
e
);
}
catch
(...)
{
}
try
{
throw
e
;
std
::
rethrow_exception
(
ep
)
;
}
catch
(
const
ProtocolError
&
pe
)
{
r
.
Error
(
pe
.
GetCode
(),
pe
.
what
());
}
catch
(
const
PlaylistError
&
pe
)
{
r
.
Error
(
ToAck
(
pe
.
GetCode
()),
pe
.
what
());
}
catch
(
const
std
::
system_error
&
)
{
}
catch
(
const
std
::
system_error
&
e
)
{
r
.
Error
(
ACK_ERROR_SYSTEM
,
e
.
what
());
}
catch
(
...
)
{
}
catch
(
const
std
::
exception
&
e
)
{
r
.
Error
(
ACK_ERROR_UNKNOWN
,
e
.
what
());
}
catch
(...)
{
r
.
Error
(
ACK_ERROR_UNKNOWN
,
"Unknown error"
);
}
}
src/command/CommandError.hxx
View file @
1c904000
...
...
@@ -24,7 +24,7 @@
#include "PlaylistError.hxx"
namespace
std
{
class
exception
;
class
exception
_ptr
;
}
class
Response
;
...
...
@@ -40,6 +40,6 @@ CommandResult
print_error
(
Response
&
r
,
const
Error
&
error
);
void
PrintError
(
Response
&
r
,
const
std
::
exception
&
e
);
PrintError
(
Response
&
r
,
std
::
exception_ptr
ep
);
#endif
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