Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Y
YAT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
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
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software Control System
Libraries
YAT
Commits
107c9e50
Commit
107c9e50
authored
Jan 16, 2024
by
Stéphane Poirier
Browse files
Options
Downloads
Patches
Plain Diff
Formatter for Error class
parent
14849a2b
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
include/yat/utils/String.h
+29
-1
29 additions, 1 deletion
include/yat/utils/String.h
with
29 additions
and
1 deletion
include/yat/utils/String.h
+
29
−
1
View file @
107c9e50
...
@@ -1679,6 +1679,34 @@ struct Format::Formatter< SharedPtr<T,L> >
...
@@ -1679,6 +1679,34 @@ struct Format::Formatter< SharedPtr<T,L> >
}
}
};
};
//==================================================================================================
//! \brief for using with yat::Error class
//!
//! No specific format syntax defined for this formatter\n
//! Output the three values of an exception\n
//==================================================================================================
template
<
>
struct
Format
::
Formatter
<
Error
>
{
void
operator
()(
const
Error
&
err
,
std
::
ostream
&
oss
,
const
Format
::
Context
&
fc
)
{
// setup width & alignment
prepare_format
(
oss
,
fc
,
's'
);
if
(
!
fc
.
fmt_ext
.
empty
()
)
{
if
(
fc
.
fmt_ext
[
0
]
==
'r'
)
oss
<<
err
.
reason
;
else
if
(
fc
.
fmt_ext
[
0
]
==
'd'
)
oss
<<
err
.
desc
;
else
if
(
fc
.
fmt_ext
[
0
]
==
'o'
)
oss
<<
err
.
origin
;
}
else
oss
<<
"what: "
<<
err
.
reason
<<
". why: "
<<
err
.
desc
<<
". where: "
<<
err
.
origin
;
}
};
//! @deprecated original class name
//! @deprecated original class name
typedef
Format
StringFormat
;
typedef
Format
StringFormat
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment