Commit 57797cf6 authored by Aaron Dees's avatar Aaron Dees
Browse files

Merge branch 's3_error_handling' into 'devel'

S3 error handling

See merge request oilgas/ltfs/fiphoboserver!23
parents 4447cb00 b45eb717
Pipeline #1260 passed with stages
in 5 minutes and 51 seconds
...@@ -19,7 +19,7 @@ CASE_SENSE_NAMES = YES ...@@ -19,7 +19,7 @@ CASE_SENSE_NAMES = YES
# Warning options # Warning options
# Warn on everything possible, and fail on warning # Warn on everything possible, and fail on warning
QUIET = NO QUIET = YES
WARNINGS = YES WARNINGS = YES
WARN_IF_UNDOCUMENTED = NO WARN_IF_UNDOCUMENTED = NO
WARN_IF_DOC_ERROR = YES WARN_IF_DOC_ERROR = YES
...@@ -50,4 +50,3 @@ PREDEFINED = __cplusplus ...@@ -50,4 +50,3 @@ PREDEFINED = __cplusplus
SEARCH_INCLUDES = YES SEARCH_INCLUDES = YES
GENERATE_XML = YES GENERATE_XML = YES
XML_NS_MEMB_FILE_SCOPE = YES
...@@ -20,6 +20,7 @@ Is inherited by [fiphoboserver::IOException][fiphoboserver-IOException], [fiphob ...@@ -20,6 +20,7 @@ Is inherited by [fiphoboserver::IOException][fiphoboserver-IOException], [fiphob
| [FIPhoboServerException](#fiphoboserver-FIPhoboServerException-FIPhoboServerException) | default constructor | | [FIPhoboServerException](#fiphoboserver-FIPhoboServerException-FIPhoboServerException) | default constructor |
| [FIPhoboServerException](#fiphoboserver-FIPhoboServerException-FIPhoboServerException-1) | constructor for a message with information on the exception | | [FIPhoboServerException](#fiphoboserver-FIPhoboServerException-FIPhoboServerException-1) | constructor for a message with information on the exception |
| [what](#fiphoboserver-FIPhoboServerException-what) | get information on this exception | | [what](#fiphoboserver-FIPhoboServerException-what) | get information on this exception |
| [get_inner_error](#fiphoboserver-FIPhoboServerException-get_inner_error) | return the inner error value that caused this exception |
...@@ -107,6 +108,30 @@ get information on this exception ...@@ -107,6 +108,30 @@ get information on this exception
#### Qualifiers:
* const
* inline
* virtual
[Go to Top](#fiphoboserver-FIPhoboServerException)
### <a name='fiphoboserver-FIPhoboServerException-get_inner_error' /> public int fiphoboserver::FIPhoboServerException::get_inner_error () const noexcept
return the inner error value that caused this exception
#### Returns:
| Type | Description |
| ---- | ---- |
| int | |
#### Qualifiers: #### Qualifiers:
* const * const
* inline * inline
......
...@@ -8,13 +8,34 @@ exceptions specifically for errors in I/O ...@@ -8,13 +8,34 @@ exceptions specifically for errors in I/O
## Inheritance: ## Inheritance:
Inherits from [fiphoboserver::FIPhoboServerException][fiphoboserver-FIPhoboServerException]. Inherits from [fiphoboserver::FIPhoboServerException][fiphoboserver-FIPhoboServerException].
## Private Attributes
| Name | Description |
| ---- | ---- |
| [m_inner_value](#fiphoboserver-IOException-m_inner_value) | the value of the error that caused this exception |
## Public Functions ## Public Functions
| Name | Description | | Name | Description |
| ---- | ---- | | ---- | ---- |
| [IOException](#fiphoboserver-IOException-IOException) | constructor | | [IOException](#fiphoboserver-IOException-IOException) | constructor |
| [get_inner_error](#fiphoboserver-IOException-get_inner_error) | return the inner error value that caused this exception |
## Private Attributes
### <a name='fiphoboserver-IOException-m_inner_value' /> private fiphoboserver::IOException::m_inner_value = 0
the value of the error that caused this exception
[Go to Top](#fiphoboserver-IOException)
## Public Functions ## Public Functions
### <a name='fiphoboserver-IOException-IOException' /> public fiphoboserver::IOException::IOException (const char *caller, const char *function_name, int return_value) ### <a name='fiphoboserver-IOException-IOException' /> public fiphoboserver::IOException::IOException (const char *caller, const char *function_name, int return_value)
...@@ -45,6 +66,30 @@ constructor ...@@ -45,6 +66,30 @@ constructor
* inline * inline
[Go to Top](#fiphoboserver-IOException)
### <a name='fiphoboserver-IOException-get_inner_error' /> public int fiphoboserver::IOException::get_inner_error () const noexcept override
return the inner error value that caused this exception
#### Returns:
| Type | Description |
| ---- | ---- |
| int | |
#### Qualifiers:
* const
* inline
* virtual
[Go to Top](#fiphoboserver-IOException) [Go to Top](#fiphoboserver-IOException)
[fiphoboserver-FIPhoboServerException]:./FIPhoboServerException.md [fiphoboserver-FIPhoboServerException]:./FIPhoboServerException.md
...@@ -12,13 +12,13 @@ ...@@ -12,13 +12,13 @@
| [HandlerFactory](./HandlerFactory.md) | factory to create the handlers for incoming HTTP requests | | [HandlerFactory](./HandlerFactory.md) | factory to create the handlers for incoming HTTP requests |
| [IOException](./IOException.md) | exceptions specifically for errors in I/O | | [IOException](./IOException.md) | exceptions specifically for errors in I/O |
| [PutRequestHandler](./PutRequestHandler.md) | proxygen class implementation for handling PUT requests | | [PutRequestHandler](./PutRequestHandler.md) | proxygen class implementation for handling PUT requests |
| [S3_header](./S3_header.md) | class to extract the S3 specific information from proxygens HTTPMessage headers |
| [UnsupportedRequestHandler](./UnsupportedRequestHandler.md) | proxygen class implementation for handling all requests that we don't support | | [UnsupportedRequestHandler](./UnsupportedRequestHandler.md) | proxygen class implementation for handling all requests that we don't support |
## Namespaces ## Namespaces
| Name | Description | | Name | Description |
| ---- | ---- | | ---- | ---- |
| [s3_utilities](./s3_utilities/index.md) | namespace for S3 specific utilities |
| [storage](./storage/index.md) | namespace for storage classes that belong to / inherit from from [fiphoboserver::storage::Storage][fiphoboserver-storage-Storage] | | [storage](./storage/index.md) | namespace for storage classes that belong to / inherit from from [fiphoboserver::storage::Storage][fiphoboserver-storage-Storage] |
| [stream](./stream/index.md) | namespace for stream classes that belong to / inherit from from [fiphoboserver::stream::Stream][fiphoboserver-stream-Stream] | | [stream](./stream/index.md) | namespace for stream classes that belong to / inherit from from [fiphoboserver::stream::Stream][fiphoboserver-stream-Stream] |
......
# <a name='fiphoboserver-S3_header' /> public fiphoboserver::S3_header # <a name='fiphoboserver-s3_utilities-S3_header' /> public fiphoboserver::s3_utilities::S3_header
class to extract the S3 specific information from proxygens HTTPMessage headers class to extract the S3 specific information from proxygens HTTPMessage headers
...@@ -8,18 +8,19 @@ class to extract the S3 specific information from proxygens HTTPMessage headers ...@@ -8,18 +8,19 @@ class to extract the S3 specific information from proxygens HTTPMessage headers
## Public Functions ## Public Functions
| Name | Description | | Name | Description |
| ---- | ---- | | ---- | ---- |
| [set_headers](#fiphoboserver-S3_header-set_headers) | sets the internal header instance to the given header object | | [set_headers](#fiphoboserver-s3_utilities-S3_header-set_headers) | sets the internal header instance to the given header object |
| [get_bucket](#fiphoboserver-S3_header-get_bucket) | extracts the name of the S3 bucket requested in the HTTP message | | [get_bucket](#fiphoboserver-s3_utilities-S3_header-get_bucket) | extracts the name of the S3 bucket requested in the HTTP message |
| [get_key_without_bucket](#fiphoboserver-S3_header-get_key_without_bucket) | extracts the name of the key id requested in the HTTP message | | [get_key_without_bucket](#fiphoboserver-s3_utilities-S3_header-get_key_without_bucket) | extracts the name of the key id requested in the HTTP message |
| [get_key](#fiphoboserver-S3_header-get_key) | extracts the name of the key id requested in the HTTP message | | [get_key](#fiphoboserver-s3_utilities-S3_header-get_key) | extracts the name of the key id requested in the HTTP message |
| [is_create_bucket_request](#fiphoboserver-S3_header-is_create_bucket_request) | checks if the message we got is one for just creating a bucket | | [is_create_bucket_request](#fiphoboserver-s3_utilities-S3_header-is_create_bucket_request) | checks if the message we got is one for just creating a bucket |
| [get_body_length](#fiphoboserver-S3_header-get_body_length) | gets the total length of all body chunks that is expected | | [get_body_length](#fiphoboserver-s3_utilities-S3_header-get_body_length) | gets the total length of all body chunks that is expected |
| [get_meta_data](#fiphoboserver-S3_header-get_meta_data) | gets the S3 metadata stored in the HTTP headers | | [get_meta_data](#fiphoboserver-s3_utilities-S3_header-get_meta_data) | gets the S3 metadata stored in the HTTP headers |
| [print_all_headers](#fiphoboserver-s3_utilities-S3_header-print_all_headers) | print all headers to std out |
## Public Functions ## Public Functions
### <a name='fiphoboserver-S3_header-set_headers' /> public void fiphoboserver::S3_header::set_headers (std::unique_ptr< proxygen::HTTPMessage > new_m_headers) ### <a name='fiphoboserver-s3_utilities-S3_header-set_headers' /> public void fiphoboserver::s3_utilities::S3_header::set_headers (std::unique_ptr< proxygen::HTTPMessage > new_m_headers)
sets the internal header instance to the given header object sets the internal header instance to the given header object
...@@ -46,9 +47,9 @@ sets the internal header instance to the given header object ...@@ -46,9 +47,9 @@ sets the internal header instance to the given header object
* inline * inline
[Go to Top](#fiphoboserver-S3_header) [Go to Top](#fiphoboserver-s3_utilities-S3_header)
### <a name='fiphoboserver-S3_header-get_bucket' /> public std::string fiphoboserver::S3_header::get_bucket () ### <a name='fiphoboserver-s3_utilities-S3_header-get_bucket' /> public std::string fiphoboserver::s3_utilities::S3_header::get_bucket ()
extracts the name of the S3 bucket requested in the HTTP message extracts the name of the S3 bucket requested in the HTTP message
...@@ -75,9 +76,9 @@ extracts the name of the S3 bucket requested in the HTTP message ...@@ -75,9 +76,9 @@ extracts the name of the S3 bucket requested in the HTTP message
* inline * inline
[Go to Top](#fiphoboserver-S3_header) [Go to Top](#fiphoboserver-s3_utilities-S3_header)
### <a name='fiphoboserver-S3_header-get_key_without_bucket' /> public std::string fiphoboserver::S3_header::get_key_without_bucket () ### <a name='fiphoboserver-s3_utilities-S3_header-get_key_without_bucket' /> public std::string fiphoboserver::s3_utilities::S3_header::get_key_without_bucket ()
extracts the name of the key id requested in the HTTP message extracts the name of the key id requested in the HTTP message
...@@ -104,9 +105,9 @@ This will only return the key itself without the leading bucket name! ...@@ -104,9 +105,9 @@ This will only return the key itself without the leading bucket name!
* inline * inline
[Go to Top](#fiphoboserver-S3_header) [Go to Top](#fiphoboserver-s3_utilities-S3_header)
### <a name='fiphoboserver-S3_header-get_key' /> public std::string fiphoboserver::S3_header::get_key () ### <a name='fiphoboserver-s3_utilities-S3_header-get_key' /> public std::string fiphoboserver::s3_utilities::S3_header::get_key ()
extracts the name of the key id requested in the HTTP message extracts the name of the key id requested in the HTTP message
...@@ -133,9 +134,9 @@ This is the whole path argument without the leading '/' but including the bucket ...@@ -133,9 +134,9 @@ This is the whole path argument without the leading '/' but including the bucket
* inline * inline
[Go to Top](#fiphoboserver-S3_header) [Go to Top](#fiphoboserver-s3_utilities-S3_header)
### <a name='fiphoboserver-S3_header-is_create_bucket_request' /> public bool fiphoboserver::S3_header::is_create_bucket_request () ### <a name='fiphoboserver-s3_utilities-S3_header-is_create_bucket_request' /> public bool fiphoboserver::s3_utilities::S3_header::is_create_bucket_request ()
checks if the message we got is one for just creating a bucket checks if the message we got is one for just creating a bucket
...@@ -162,9 +163,9 @@ This is convenient since we don't really support buckets themselves and can easi ...@@ -162,9 +163,9 @@ This is convenient since we don't really support buckets themselves and can easi
* inline * inline
[Go to Top](#fiphoboserver-S3_header) [Go to Top](#fiphoboserver-s3_utilities-S3_header)
### <a name='fiphoboserver-S3_header-get_body_length' /> public size_t fiphoboserver::S3_header::get_body_length () ### <a name='fiphoboserver-s3_utilities-S3_header-get_body_length' /> public size_t fiphoboserver::s3_utilities::S3_header::get_body_length ()
gets the total length of all body chunks that is expected gets the total length of all body chunks that is expected
...@@ -191,9 +192,9 @@ This reads out the header "Content-Length" ...@@ -191,9 +192,9 @@ This reads out the header "Content-Length"
* inline * inline
[Go to Top](#fiphoboserver-S3_header) [Go to Top](#fiphoboserver-s3_utilities-S3_header)
### <a name='fiphoboserver-S3_header-get_meta_data' /> public std::map< std::string, std::string > fiphoboserver::S3_header::get_meta_data () ### <a name='fiphoboserver-s3_utilities-S3_header-get_meta_data' /> public std::map< std::string, std::string > fiphoboserver::s3_utilities::S3_header::get_meta_data ()
gets the S3 metadata stored in the HTTP headers gets the S3 metadata stored in the HTTP headers
...@@ -220,5 +221,22 @@ In S3 arbitrary metadata can be defined. This has the form x-amx-meta-KEY: VALUE ...@@ -220,5 +221,22 @@ In S3 arbitrary metadata can be defined. This has the form x-amx-meta-KEY: VALUE
* inline * inline
[Go to Top](#fiphoboserver-S3_header) [Go to Top](#fiphoboserver-s3_utilities-S3_header)
### <a name='fiphoboserver-s3_utilities-S3_header-print_all_headers' /> public void fiphoboserver::s3_utilities::S3_header::print_all_headers ()
print all headers to std out
#### Qualifiers:
* inline
[Go to Top](#fiphoboserver-s3_utilities-S3_header)
# <a name='fiphoboserver-s3_utilities' /> fiphoboserver::s3_utilities
namespace for S3 specific utilities
## Classes
| Name | Description |
| ---- | ---- |
| [s3_error_info](./s3_error_info.md) | struct to contain all the information needed to send a proper s3 error message |
| [S3_header](./S3_header.md) | class to extract the S3 specific information from proxygens HTTPMessage headers |
## Functions
| Name | Description |
| ---- | ---- |
| [create_s3_error](#fiphoboserver-s3_utilities-create_s3_error) | create a [s3_error_info][fiphoboserver-s3_utilities-s3_error_info] depending on the error value |
## Functions
### <a name='fiphoboserver-s3_utilities-create_s3_error' /> public [s3_error_info][fiphoboserver-s3_utilities-s3_error_info] fiphoboserver::s3_utilities::create_s3_error (int return_value, std::string request)
create a [s3_error_info][fiphoboserver-s3_utilities-s3_error_info] depending on the error value
#### Parameters:
| Type | Name | Description |
| ---- | ---- | ---- |
| int | return_value | the error code (errno, etc) that the function returned that raised the exception that preceded the call to this function |
| std::string | request | the request path that was being processed |
#### Returns:
| Type | Description |
| ---- | ---- |
| [s3_error_info][fiphoboserver-s3_utilities-s3_error_info] | an [s3_error_info][fiphoboserver-s3_utilities-s3_error_info] struct containing readable information on the error |
[Go to Top](#fiphoboserver-s3_utilities)
[fiphoboserver-s3_utilities-s3_error_info]:./s3_error_info.md#fiphoboserver-s3_utilities-s3_error_info
# <a name='fiphoboserver-s3_utilities-s3_error_info' /> public fiphoboserver::s3_utilities::s3_error_info
struct to contain all the information needed to send a proper s3 error message
## Public Attributes
| Name | Description |
| ---- | ---- |
| [https_error_code](#fiphoboserver-s3_utilities-s3_error_info-https_error_code) | https error code (400s or 500s) |
| [https_error_identifier](#fiphoboserver-s3_utilities-s3_error_info-https_error_identifier) | readable string for the code [https_error_code][fiphoboserver-s3_utilities-s3_error_info-https_error_code] |
| [error_xml](#fiphoboserver-s3_utilities-s3_error_info-error_xml) | XML encoded message containing more information on the error. |
## Public Attributes
### <a name='fiphoboserver-s3_utilities-s3_error_info-https_error_code' /> public fiphoboserver::s3_utilities::s3_error_info::https_error_code
https error code (400s or 500s)
[Go to Top](#fiphoboserver-s3_utilities-s3_error_info)
### <a name='fiphoboserver-s3_utilities-s3_error_info-https_error_identifier' /> public fiphoboserver::s3_utilities::s3_error_info::https_error_identifier
readable string for the code [https_error_code][fiphoboserver-s3_utilities-s3_error_info-https_error_code]
[Go to Top](#fiphoboserver-s3_utilities-s3_error_info)
### <a name='fiphoboserver-s3_utilities-s3_error_info-error_xml' /> public fiphoboserver::s3_utilities::s3_error_info::error_xml
XML encoded message containing more information on the error.
[Go to Top](#fiphoboserver-s3_utilities-s3_error_info)
[fiphoboserver-s3_utilities-s3_error_info-https_error_code]:./s3_error_info.md#fiphoboserver-s3_utilities-s3_error_info-https_error_code
...@@ -8,13 +8,34 @@ exceptions specifically for the phobos backend library ...@@ -8,13 +8,34 @@ exceptions specifically for the phobos backend library
## Inheritance: ## Inheritance:
Inherits from [fiphoboserver::FIPhoboServerException][fiphoboserver-FIPhoboServerException]. Inherits from [fiphoboserver::FIPhoboServerException][fiphoboserver-FIPhoboServerException].
## Private Attributes
| Name | Description |
| ---- | ---- |
| [m_inner_value](#fiphoboserver-storage-PhobosException-m_inner_value) | the value of the error that caused this exception |
## Public Functions ## Public Functions
| Name | Description | | Name | Description |
| ---- | ---- | | ---- | ---- |
| [PhobosException](#fiphoboserver-storage-PhobosException-PhobosException) | constructor | | [PhobosException](#fiphoboserver-storage-PhobosException-PhobosException) | constructor |
| [get_inner_error](#fiphoboserver-storage-PhobosException-get_inner_error) | return the inner error value that caused this exception |
## Private Attributes
### <a name='fiphoboserver-storage-PhobosException-m_inner_value' /> private fiphoboserver::storage::PhobosException::m_inner_value = 0
the value of the error that caused this exception
[Go to Top](#fiphoboserver-storage-PhobosException)
## Public Functions ## Public Functions
### <a name='fiphoboserver-storage-PhobosException-PhobosException' /> public fiphoboserver::storage::PhobosException::PhobosException (const char *caller, const char *function_name, int return_value) ### <a name='fiphoboserver-storage-PhobosException-PhobosException' /> public fiphoboserver::storage::PhobosException::PhobosException (const char *caller, const char *function_name, int return_value)
...@@ -45,6 +66,30 @@ constructor ...@@ -45,6 +66,30 @@ constructor
* inline * inline
[Go to Top](#fiphoboserver-storage-PhobosException)
### <a name='fiphoboserver-storage-PhobosException-get_inner_error' /> public int fiphoboserver::storage::PhobosException::get_inner_error () const noexcept override
return the inner error value that caused this exception
#### Returns:
| Type | Description |
| ---- | ---- |
| int | |
#### Qualifiers:
* const
* inline
* virtual
[Go to Top](#fiphoboserver-storage-PhobosException) [Go to Top](#fiphoboserver-storage-PhobosException)
[fiphoboserver-FIPhoboServerException]:./../FIPhoboServerException.md [fiphoboserver-FIPhoboServerException]:./../FIPhoboServerException.md
...@@ -84,26 +84,40 @@ default destructor ...@@ -84,26 +84,40 @@ default destructor
[Go to Top](#fiphoboserver-storage-Phobos_file) [Go to Top](#fiphoboserver-storage-Phobos_file)
### <a name='fiphoboserver-storage-Phobos_file-Phobos_file-1' /> public fiphoboserver::storage::Phobos_file::Phobos_file (Phobos_file &&)=default ### <a name='fiphoboserver-storage-Phobos_file-Phobos_file-1' /> public fiphoboserver::storage::Phobos_file::Phobos_file (Phobos_file &&input)
default move contructor default move contructor
#### Parameters:
| Type | Name | Description |
| ---- | ---- | ---- |
| [Phobos_file][fiphoboserver-storage-Phobos_file] && | input | |
#### Qualifiers:
* inline
[Go to Top](#fiphoboserver-storage-Phobos_file) [Go to Top](#fiphoboserver-storage-Phobos_file)
### <a name='fiphoboserver-storage-Phobos_file-operator=' /> public [Phobos_file][fiphoboserver-storage-Phobos_file] & fiphoboserver::storage::Phobos_file::operator= (Phobos_file &&)=default ### <a name='fiphoboserver-storage-Phobos_file-operator=' /> public [Phobos_file][fiphoboserver-storage-Phobos_file] & fiphoboserver::storage::Phobos_file::operator= (Phobos_file &&input)
default assignment operator for rvalue references default assignment operator for rvalue references
#### Parameters:
| Type | Name | Description |
| ---- | ---- | ---- |
| [Phobos_file][fiphoboserver-storage-Phobos_file] && | input | |
#### Returns: #### Returns:
| Type | Description | | Type | Description |
| ---- | ---- | | ---- | ---- |
...@@ -113,6 +127,10 @@ default assignment operator for rvalue references ...@@ -113,6 +127,10 @@ default assignment operator for rvalue references
#### Qualifiers:
* inline
[Go to Top](#fiphoboserver-storage-Phobos_file) [Go to Top](#fiphoboserver-storage-Phobos_file)
### <a name='fiphoboserver-storage-Phobos_file-Phobos_file-2' /> public fiphoboserver::storage::Phobos_file::Phobos_file (const Phobos_file &)=delete ### <a name='fiphoboserver-storage-Phobos_file-Phobos_file-2' /> public fiphoboserver::storage::Phobos_file::Phobos_file (const Phobos_file &)=delete
......
...@@ -26,7 +26,7 @@ paths: ...@@ -26,7 +26,7 @@ paths:
get: <