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
e5f23678
Commit
e5f23678
authored
May 22, 2019
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Log: use GetFullMessage() to print exceptions
Print all nested exceptions on a single line to avoid confusion.
parent
749ad7cd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
38 deletions
+6
-38
Log.cxx
src/Log.cxx
+6
-38
No files found.
src/Log.cxx
View file @
e5f23678
...
...
@@ -19,8 +19,7 @@
#include "LogV.hxx"
#include "util/Domain.hxx"
#include <exception>
#include "util/Exception.hxx"
#include <stdio.h>
#include <string.h>
...
...
@@ -94,31 +93,13 @@ FormatError(const Domain &domain, const char *fmt, ...) noexcept
void
LogError
(
const
std
::
exception
&
e
)
noexcept
{
Log
(
exception_domain
,
LogLevel
::
ERROR
,
e
.
what
());
try
{
std
::
rethrow_if_nested
(
e
);
}
catch
(
const
std
::
exception
&
nested
)
{
LogError
(
nested
,
"nested"
);
}
catch
(...)
{
Log
(
exception_domain
,
LogLevel
::
ERROR
,
"Unrecognized nested exception"
);
}
LogError
(
exception_domain
,
GetFullMessage
(
e
).
c_str
());
}
void
LogError
(
const
std
::
exception
&
e
,
const
char
*
msg
)
noexcept
{
FormatError
(
exception_domain
,
"%s: %s"
,
msg
,
e
.
what
());
try
{
std
::
rethrow_if_nested
(
e
);
}
catch
(
const
std
::
exception
&
nested
)
{
LogError
(
nested
);
}
catch
(...)
{
Log
(
exception_domain
,
LogLevel
::
ERROR
,
"Unrecognized nested exception"
);
}
FormatError
(
exception_domain
,
"%s: %s"
,
msg
,
GetFullMessage
(
e
).
c_str
());
}
void
...
...
@@ -136,27 +117,14 @@ FormatError(const std::exception &e, const char *fmt, ...) noexcept
void
LogError
(
const
std
::
exception_ptr
&
ep
)
noexcept
{
try
{
std
::
rethrow_exception
(
ep
);
}
catch
(
const
std
::
exception
&
e
)
{
LogError
(
e
);
}
catch
(...)
{
Log
(
exception_domain
,
LogLevel
::
ERROR
,
"Unrecognized exception"
);
}
LogError
(
exception_domain
,
GetFullMessage
(
ep
).
c_str
());
}
void
LogError
(
const
std
::
exception_ptr
&
ep
,
const
char
*
msg
)
noexcept
{
try
{
std
::
rethrow_exception
(
ep
);
}
catch
(
const
std
::
exception
&
e
)
{
LogError
(
e
,
msg
);
}
catch
(...)
{
FormatError
(
exception_domain
,
"%s: Unrecognized exception"
,
msg
);
}
FormatError
(
exception_domain
,
"%s: %s"
,
msg
,
GetFullMessage
(
ep
).
c_str
());
}
void
...
...
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