Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
ftl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nicolas Pope
ftl
Merge requests
!309
Decode trace symbols only when trace requested (GCC)
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Decode trace symbols only when trace requested (GCC)
exception-trace
into
master
Overview
0
Commits
1
Pipelines
1
Changes
2
Merged
Sebastian Hahta
requested to merge
exception-trace
into
master
4 years ago
Overview
0
Commits
1
Pipelines
1
Changes
2
Expand
0
0
Merge request reports
Compare
master
master (base)
and
latest version
latest version
ba526ce5
1 commit,
4 years ago
2 files
+
64
−
51
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
components/common/cpp/include/ftl/exception.hpp
+
32
−
24
Options
@@ -7,29 +7,29 @@ namespace ftl {
class
Formatter
{
public:
Formatter
()
{}
~
Formatter
()
{}
~
Formatter
()
{}
template
<
typename
Type
>
inline
Formatter
&
operator
<<
(
const
Type
&
value
)
{
stream_
<<
value
;
return
*
this
;
}
template
<
typename
Type
>
inline
Formatter
&
operator
<<
(
const
Type
&
value
)
{
stream_
<<
value
;
return
*
this
;
}
inline
std
::
string
str
()
const
{
return
stream_
.
str
();
}
inline
operator
std
::
string
()
const
{
return
stream_
.
str
();
}
inline
std
::
string
str
()
const
{
return
stream_
.
str
();
}
inline
operator
std
::
string
()
const
{
return
stream_
.
str
();
}
enum
ConvertToString
{
to_str
};
inline
std
::
string
operator
>>
(
ConvertToString
)
{
return
stream_
.
str
();
}
enum
ConvertToString
{
to_str
};
inline
std
::
string
operator
>>
(
ConvertToString
)
{
return
stream_
.
str
();
}
private
:
std
::
stringstream
stream_
;
std
::
stringstream
stream_
;
Formatter
(
const
Formatter
&
);
Formatter
&
operator
=
(
Formatter
&
);
Formatter
(
const
Formatter
&
);
Formatter
&
operator
=
(
Formatter
&
);
};
class
exception
:
public
std
::
exception
@@ -39,22 +39,30 @@ class exception : public std::exception
explicit
exception
(
const
Formatter
&
msg
);
~
exception
();
const
char
*
what
()
const
throw
()
{
const
char
*
what
()
const
throw
()
{
processed_
=
true
;
return
msg_
.
c_str
();
}
return
msg_
.
c_str
();
}
const
char
*
trace
()
const
throw
()
{
return
trace_
.
c_str
();
}
std
::
string
trace
()
const
throw
()
{
return
decode_backtrace
();
}
void
ignore
()
const
{
processed_
=
true
;
}
private
:
std
::
string
decode_backtrace
()
const
;
std
::
string
msg_
;
std
::
string
trace_
;
mutable
bool
processed_
;
#ifdef __GNUC__
static
const
int
TRACE_SIZE_MAX_
=
16
;
void
*
trace_
[
TRACE_SIZE_MAX_
];
int
trace_size_
;
#endif
};
}
#define FTL_Error(A) (ftl::exception(ftl::Formatter() << __FILE__ << ":" << __LINE__ << ": " << A))
Loading