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
d9e8ce22
Commit
d9e8ce22
authored
Feb 26, 2016
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
util/Error: use std::exception_ptr instead of std::exception
Necessary to preserve type information. The try/catch sequence didn't work previously. Same fix as in commit
1c904000
parent
c85ba733
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
14 deletions
+12
-14
SimpleDatabasePlugin.cxx
src/db/plugins/simple/SimpleDatabasePlugin.cxx
+1
-1
FileInputPlugin.cxx
src/input/plugins/FileInputPlugin.cxx
+3
-3
Error.cxx
src/util/Error.cxx
+6
-5
Error.hxx
src/util/Error.hxx
+2
-5
No files found.
src/db/plugins/simple/SimpleDatabasePlugin.cxx
View file @
d9e8ce22
...
...
@@ -222,7 +222,7 @@ try {
return
true
;
}
catch
(
const
std
::
exception
&
e
)
{
error
.
Set
(
e
);
error
.
Set
(
std
::
current_exception
()
);
return
false
;
}
...
...
src/input/plugins/FileInputPlugin.cxx
View file @
d9e8ce22
...
...
@@ -81,7 +81,7 @@ try {
std
::
move
(
reader
),
info
.
GetSize
(),
mutex
,
cond
);
}
catch
(
const
std
::
exception
&
e
)
{
error
.
Set
(
e
);
error
.
Set
(
std
::
current_exception
()
);
return
nullptr
;
}
...
...
@@ -102,7 +102,7 @@ try {
offset
=
new_offset
;
return
true
;
}
catch
(
const
std
::
exception
&
e
)
{
error
.
Set
(
e
);
error
.
Set
(
std
::
current_exception
()
);
return
false
;
}
...
...
@@ -113,7 +113,7 @@ try {
offset
+=
nbytes
;
return
nbytes
;
}
catch
(
const
std
::
exception
&
e
)
{
error
.
Set
(
e
);
error
.
Set
(
std
::
current_exception
()
);
return
0
;
}
...
...
src/util/Error.cxx
View file @
d9e8ce22
...
...
@@ -31,7 +31,6 @@
#include "Error.hxx"
#include "Domain.hxx"
#include <exception>
#include <system_error>
#ifdef WIN32
...
...
@@ -54,11 +53,11 @@ const Domain win32_domain("win32");
Error
::~
Error
()
{}
void
Error
::
Set
(
const
std
::
exception
&
src
)
Error
::
Set
(
std
::
exception_ptr
src
)
{
try
{
/* classify the exception */
throw
src
;
std
::
rethrow_exception
(
src
)
;
}
catch
(
const
std
::
system_error
&
se
)
{
if
(
se
.
code
().
category
()
==
std
::
system_category
())
{
#ifdef WIN32
...
...
@@ -67,9 +66,11 @@ Error::Set(const std::exception &src)
Set
(
errno_domain
,
se
.
code
().
value
(),
se
.
what
());
#endif
}
else
Set
(
exception_domain
,
src
.
what
());
Set
(
exception_domain
,
se
.
what
());
}
catch
(
const
std
::
exception
&
e
)
{
Set
(
exception_domain
,
e
.
what
());
}
catch
(...)
{
Set
(
exception_domain
,
src
.
what
()
);
Set
(
exception_domain
,
"Unknown exception"
);
}
}
...
...
src/util/Error.hxx
View file @
d9e8ce22
...
...
@@ -35,15 +35,12 @@
#include <string>
#include <utility>
#include <exception>
#include <assert.h>
class
Domain
;
namespace
std
{
class
exception
;
}
/** Domain for std::exception */
extern
const
Domain
exception_domain
;
...
...
@@ -133,7 +130,7 @@ public:
message
=
other
.
message
;
}
void
Set
(
const
std
::
exception
&
src
);
void
Set
(
std
::
exception_ptr
src
);
void
Set
(
const
Domain
&
_domain
,
int
_code
,
const
char
*
_message
);
...
...
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