Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
CTA
Manage
Activity
Members
Labels
Plan
Issues
217
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
27
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
cta
CTA
Merge requests
!437
Resolve "Fix incorrect type in Errnum class"
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Resolve "Fix incorrect type in Errnum class"
584-fix-incorrect-type-in-errnum-class
into
main
Overview
0
Commits
6
Pipelines
7
Changes
12
Merged
Michael Davis
requested to merge
584-fix-incorrect-type-in-errnum-class
into
main
1 year ago
Overview
0
Commits
6
Pipelines
7
Changes
12
Expand
Summary
Requires manual tests in pre-production
References
Closes
#584 (closed)
👍
0
👎
0
Merge request reports
Compare
main
version 5
ad34dd5e
1 year ago
version 4
2a233774
1 year ago
version 3
6b17f1de
1 year ago
version 2
b5d991d2
1 year ago
version 1
81df109b
1 year ago
main (base)
and
latest version
latest version
581c01a6
6 commits,
1 year ago
version 5
ad34dd5e
5 commits,
1 year ago
version 4
2a233774
4 commits,
1 year ago
version 3
6b17f1de
3 commits,
1 year ago
version 2
b5d991d2
2 commits,
1 year ago
version 1
81df109b
1 commit,
1 year ago
12 files
+
117
−
168
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
12
Search (e.g. *.vue) (Ctrl+P)
common/exception/Errnum.cpp
+
18
−
39
Options
@@ -18,54 +18,33 @@
#include
"common/exception/Errnum.hpp"
#include
"common/utils/utils.hpp"
#include
<errno.h>
#include
<string.h>
namespace
cta
::
exception
{
using
namespace
cta
::
exception
;
Errnum
::
Errnum
(
std
::
string
what
)
:
Exception
(
""
)
{
m_errnum
=
errno
;
ErrnumConstructorBottomHalf
(
what
);
Errnum
::
Errnum
(
int
err
,
std
::
string_view
what
)
:
Exception
(),
m_errnum
(
err
),
m_strerror
(
utils
::
errnoToString
(
err
))
{
std
::
stringstream
whatWithErrnum
;
whatWithErrnum
<<
what
<<
(
what
.
empty
()
?
""
:
" "
)
<<
"Errno="
<<
m_errnum
<<
": "
<<
m_strerror
;
getMessage
()
<<
whatWithErrnum
.
str
();
}
Errnum
::
Errnum
(
int
err
,
std
::
string
what
)
:
Exception
(
""
)
{
m_errnum
=
err
;
ErrnumConstructorBottomHalf
(
what
);
}
Errnum
::
Errnum
(
std
::
string_view
what
)
:
Errnum
(
errno
,
what
)
{
}
void
Errnum
::
ErrnumConstructorBottomHalf
(
const
std
::
string
&
what
)
{
m_strerror
=
utils
::
errnoToString
(
m_errnum
);
std
::
stringstream
w2
;
if
(
what
.
size
())
w2
<<
what
<<
" "
;
w2
<<
"Errno="
<<
m_errnum
<<
": "
<<
m_strerror
;
getMessage
()
<<
w2
.
str
();
void
Errnum
::
throwOnReturnedErrno
(
int
err
,
std
::
string_view
context
)
{
if
(
err
)
throw
Errnum
(
err
,
context
);
}
void
Errnum
::
throwOn
ReturnedErrno
(
const
int
err
,
const
std
::
string
&
context
)
{
if
(
err
)
throw
Errnum
(
err
,
context
);
void
Errnum
::
throwOn
NonZero
(
int
status
,
std
::
string
_view
context
)
{
if
(
status
)
throw
Errnum
(
context
);
}
void
Errnum
::
throwOnN
onZero
(
const
int
status
,
const
std
::
string
&
context
)
{
if
(
status
)
throw
Errnum
(
context
);
void
Errnum
::
throwOnN
ull
(
const
void
*
const
ptr
,
std
::
string
_view
context
)
{
if
(
nullptr
==
ptr
)
throw
Errnum
(
context
);
}
void
Errnum
::
throwOn
Zero
(
const
int
status
,
const
std
::
string
&
context
)
{
if
(
!
status
)
throw
Errnum
(
context
);
void
Errnum
::
throwOn
MinusOne
(
ssize_t
ret
,
std
::
string
_view
context
)
{
if
(
ret
==
-
1
)
throw
Errnum
(
context
);
}
void
Errnum
::
throwOnNull
(
const
void
*
const
f
,
const
std
::
string
&
context
)
{
if
(
nullptr
==
f
)
throw
Errnum
(
context
);
}
void
Errnum
::
throwOnNegative
(
const
int
ret
,
const
std
::
string
&
context
)
{
if
(
ret
<
0
)
throw
Errnum
(
context
);
}
void
Errnum
::
throwOnMinusOne
(
const
int
ret
,
const
std
::
string
&
context
)
{
if
(
-
1
==
ret
)
throw
Errnum
(
context
);
}
void
Errnum
::
throwOnNegativeErrnoIfNegative
(
const
int
ret
,
const
std
::
string
&
context
)
{
if
(
ret
<
0
)
throw
Errnum
(
-
ret
,
context
);
}
}
// namespace cta::exception
Loading