Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-cpplib
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
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
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
caosdb
Software
caosdb-cpplib
Commits
b9aa2c79
Commit
b9aa2c79
authored
3 years ago
by
Daniel Hornung
Browse files
Options
Downloads
Patches
Plain Diff
MAINT: Renamed GenericException -> Exception.
parent
4a738a7a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!3
Better Error Handling and Logging
Pipeline
#10978
passed
3 years ago
Stage: info
Stage: setup
Stage: test
Stage: deploy
Pipeline: caosdb-cppinttest
#10979
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/caosdb/exceptions.h
+12
-12
12 additions, 12 deletions
include/caosdb/exceptions.h
include/caosdb/transaction_status.h
+2
-2
2 additions, 2 deletions
include/caosdb/transaction_status.h
src/caosdb/configuration.cpp
+2
-2
2 additions, 2 deletions
src/caosdb/configuration.cpp
with
16 additions
and
16 deletions
include/caosdb/exceptions.h
+
12
−
12
View file @
b9aa2c79
...
@@ -32,9 +32,9 @@ using std::runtime_error;
...
@@ -32,9 +32,9 @@ using std::runtime_error;
/**
/**
* @brief Generic exception class of the caosdb client library.
* @brief Generic exception class of the caosdb client library.
*/
*/
class
Generic
Exception
:
public
runtime_error
{
class
Exception
:
public
runtime_error
{
public:
public:
explicit
Generic
Exception
(
StatusCode
code
,
const
std
::
string
&
what_arg
)
explicit
Exception
(
StatusCode
code
,
const
std
::
string
&
what_arg
)
:
runtime_error
(
what_arg
),
code
(
code
)
{}
:
runtime_error
(
what_arg
),
code
(
code
)
{}
[[
nodiscard
]]
inline
auto
GetCode
()
const
->
StatusCode
{
return
this
->
code
;
}
[[
nodiscard
]]
inline
auto
GetCode
()
const
->
StatusCode
{
return
this
->
code
;
}
...
@@ -45,47 +45,47 @@ private:
...
@@ -45,47 +45,47 @@ private:
/**
/**
* @brief Exception for authentication errors.
* @brief Exception for authentication errors.
*/
*/
class
AuthenticationError
:
public
Generic
Exception
{
class
AuthenticationError
:
public
Exception
{
public:
public:
explicit
AuthenticationError
(
const
std
::
string
&
what_arg
)
explicit
AuthenticationError
(
const
std
::
string
&
what_arg
)
:
Generic
Exception
(
StatusCode
::
AUTHENTICATION_ERROR
,
what_arg
)
{}
:
Exception
(
StatusCode
::
AUTHENTICATION_ERROR
,
what_arg
)
{}
};
};
/**
/**
* @brief The connection to the CaosDB server is down.
* @brief The connection to the CaosDB server is down.
*/
*/
class
ConnectionError
:
public
Generic
Exception
{
class
ConnectionError
:
public
Exception
{
public:
public:
explicit
ConnectionError
(
const
std
::
string
&
what_arg
)
explicit
ConnectionError
(
const
std
::
string
&
what_arg
)
:
Generic
Exception
(
StatusCode
::
CONNECTION_ERROR
,
what_arg
)
{}
:
Exception
(
StatusCode
::
CONNECTION_ERROR
,
what_arg
)
{}
};
};
/**
/**
* @brief The transaction terminated unsuccessfully.
* @brief The transaction terminated unsuccessfully.
*/
*/
class
TransactionError
:
public
Generic
Exception
{
class
TransactionError
:
public
Exception
{
public:
public:
explicit
TransactionError
(
const
std
::
string
&
what_arg
)
explicit
TransactionError
(
const
std
::
string
&
what_arg
)
:
Generic
Exception
(
StatusCode
::
GENERIC_TRANSACTION_ERROR
,
what_arg
)
{}
:
Exception
(
StatusCode
::
GENERIC_TRANSACTION_ERROR
,
what_arg
)
{}
};
};
/**
/**
* @brief Exception for errors of the ConfigurationManager or other components
* @brief Exception for errors of the ConfigurationManager or other components
* of the configuration.
* of the configuration.
*/
*/
class
ConfigurationError
:
public
Generic
Exception
{
class
ConfigurationError
:
public
Exception
{
public:
public:
explicit
ConfigurationError
(
const
std
::
string
&
what_arg
)
explicit
ConfigurationError
(
const
std
::
string
&
what_arg
)
:
Generic
Exception
(
StatusCode
::
CONFIGURATION_ERROR
,
what_arg
)
{}
:
Exception
(
StatusCode
::
CONFIGURATION_ERROR
,
what_arg
)
{}
};
};
/**
/**
* @brief The connection isn't known to the ConnectionManager under this name.
* @brief The connection isn't known to the ConnectionManager under this name.
*/
*/
class
UnknownConnectionError
:
public
Generic
Exception
{
class
UnknownConnectionError
:
public
Exception
{
public:
public:
explicit
UnknownConnectionError
(
const
std
::
string
&
what_arg
)
explicit
UnknownConnectionError
(
const
std
::
string
&
what_arg
)
:
Generic
Exception
(
StatusCode
::
UNKNOWN_CONNECTION_ERROR
,
what_arg
)
{}
:
Exception
(
StatusCode
::
UNKNOWN_CONNECTION_ERROR
,
what_arg
)
{}
};
};
}
// namespace caosdb::exceptions
}
// namespace caosdb::exceptions
...
...
This diff is collapsed.
Click to expand it.
include/caosdb/transaction_status.h
+
2
−
2
View file @
b9aa2c79
...
@@ -35,7 +35,7 @@ namespace caosdb::transaction {
...
@@ -35,7 +35,7 @@ namespace caosdb::transaction {
using
caosdb
::
StatusCode
;
using
caosdb
::
StatusCode
;
using
caosdb
::
exceptions
::
AuthenticationError
;
using
caosdb
::
exceptions
::
AuthenticationError
;
using
caosdb
::
exceptions
::
ConnectionError
;
using
caosdb
::
exceptions
::
ConnectionError
;
using
caosdb
::
exceptions
::
Generic
Exception
;
using
caosdb
::
exceptions
::
Exception
;
using
caosdb
::
exceptions
::
TransactionError
;
using
caosdb
::
exceptions
::
TransactionError
;
/**
/**
...
@@ -113,7 +113,7 @@ public:
...
@@ -113,7 +113,7 @@ public:
case
StatusCode
::
GENERIC_TRANSACTION_ERROR
:
case
StatusCode
::
GENERIC_TRANSACTION_ERROR
:
throw
TransactionError
(
this
->
description
);
throw
TransactionError
(
this
->
description
);
default:
default:
throw
Generic
Exception
(
StatusCode
::
GENERIC_ERROR
,
this
->
description
);
throw
Exception
(
StatusCode
::
GENERIC_ERROR
,
this
->
description
);
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
src/caosdb/configuration.cpp
+
2
−
2
View file @
b9aa2c79
...
@@ -357,7 +357,7 @@ auto ConfigurationManager::mReset() noexcept -> int {
...
@@ -357,7 +357,7 @@ auto ConfigurationManager::mReset() noexcept -> int {
mClear
();
mClear
();
InitializeDefaults
();
InitializeDefaults
();
return
StatusCode
::
SUCCESS
;
return
StatusCode
::
SUCCESS
;
}
catch
(
const
caosdb
::
exceptions
::
Generic
Exception
&
exc
)
{
}
catch
(
const
caosdb
::
exceptions
::
Exception
&
exc
)
{
return
exc
.
GetCode
();
return
exc
.
GetCode
();
}
catch
(
const
std
::
exception
&
exc
)
{
}
catch
(
const
std
::
exception
&
exc
)
{
CAOSDB_LOG_ERROR
(
logger_name
)
CAOSDB_LOG_ERROR
(
logger_name
)
...
@@ -372,7 +372,7 @@ auto ConfigurationManager::mClear() noexcept -> int {
...
@@ -372,7 +372,7 @@ auto ConfigurationManager::mClear() noexcept -> int {
json_configuration
=
value
(
nullptr
);
json_configuration
=
value
(
nullptr
);
ConnectionManager
::
Reset
();
ConnectionManager
::
Reset
();
return
StatusCode
::
SUCCESS
;
return
StatusCode
::
SUCCESS
;
}
catch
(
const
caosdb
::
exceptions
::
Generic
Exception
&
exc
)
{
}
catch
(
const
caosdb
::
exceptions
::
Exception
&
exc
)
{
return
exc
.
GetCode
();
return
exc
.
GetCode
();
}
catch
(
const
std
::
exception
&
exc
)
{
}
catch
(
const
std
::
exception
&
exc
)
{
CAOSDB_LOG_ERROR
(
logger_name
)
CAOSDB_LOG_ERROR
(
logger_name
)
...
...
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