Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
Actor Framework
Commits
360c43b0
Commit
360c43b0
authored
Aug 23, 2011
by
neverlord
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
inlined exception::reason
parent
51fc3699
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
35 deletions
+34
-35
cppa/exception.hpp
cppa/exception.hpp
+6
-1
src/exception.cpp
src/exception.cpp
+28
-34
No files found.
cppa/exception.hpp
View file @
360c43b0
...
...
@@ -32,7 +32,7 @@ class actor_exited : public exception
public:
actor_exited
(
std
::
uint32_t
exit_reason
);
std
::
uint32_t
reason
()
const
throw
();
inline
std
::
uint32_t
reason
()
const
throw
();
};
...
...
@@ -59,6 +59,11 @@ class bind_failure : public network_exception
};
inline
std
::
uint32_t
exception
::
reason
()
const
throw
()
{
return
m_reason
;
}
}
// namespace cppa
#endif // EXCEPTION_HPP
src/exception.cpp
View file @
360c43b0
...
...
@@ -5,6 +5,34 @@
#include <sys/un.h>
#include <stdlib.h>
namespace
{
std
::
string
ae_what
(
std
::
uint32_t
reason
)
{
std
::
ostringstream
oss
;
oss
<<
"actor exited with reason "
<<
reason
;
return
oss
.
str
();
}
std
::
string
be_what
(
int
err_code
)
{
switch
(
err_code
)
{
case
EACCES
:
return
"EACCES: address is protected; root access needed"
;
case
EADDRINUSE
:
return
"EADDRINUSE: address is already in use"
;
case
EBADF
:
return
"EBADF: no valid socket descriptor"
;
case
EINVAL
:
return
"EINVAL: socket already bound to an address"
;
case
ENOTSOCK
:
return
"ENOTSOCK: file descriptor given"
;
default:
break
;
}
std
::
stringstream
oss
;
oss
<<
"an unknown error occurred (code: "
<<
err_code
<<
")"
;
return
oss
.
str
();
}
}
// namespace <anonymous>
namespace
cppa
{
exception
::
exception
(
const
std
::
string
&
what_str
)
:
m_what
(
what_str
)
...
...
@@ -24,26 +52,11 @@ const char* exception::what() const throw()
return
m_what
.
c_str
();
}
namespace
// <anonymous>
{
std
::
string
ae_what
(
std
::
uint32_t
reason
)
{
std
::
ostringstream
oss
;
oss
<<
"actor exited with reason "
<<
reason
;
return
oss
.
str
();
}
}
// namespace <anonymous>
actor_exited
::
actor_exited
(
std
::
uint32_t
reason
)
:
exception
(
ae_what
(
reason
))
{
m_reason
=
reason
;
}
std
::
uint32_t
actor_exited
::
reason
()
const
throw
()
{
return
m_reason
;
}
network_exception
::
network_exception
(
const
std
::
string
&
str
)
:
exception
(
str
)
{
}
...
...
@@ -53,25 +66,6 @@ network_exception::network_exception(std::string&& str)
{
}
namespace
// <anonymous>
{
std
::
string
be_what
(
int
err_code
)
{
switch
(
err_code
)
{
case
EACCES
:
return
"EACCES: address is protected; root access needed"
;
case
EADDRINUSE
:
return
"EADDRINUSE: address is already in use"
;
case
EBADF
:
return
"EBADF: no valid socket descriptor"
;
case
EINVAL
:
return
"EINVAL: socket already bound to an address"
;
case
ENOTSOCK
:
return
"ENOTSOCK: file descriptor given"
;
default:
break
;
}
std
::
stringstream
oss
;
oss
<<
"an unknown error occurred (code: "
<<
err_code
<<
")"
;
return
oss
.
str
();
}
}
// namespace <anonymous>
bind_failure
::
bind_failure
(
int
err_code
)
:
network_exception
(
be_what
(
err_code
))
{
m_errno
=
err_code
;
...
...
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