Commit b45eb717 authored by Sophie Wenzel-Teuber's avatar Sophie Wenzel-Teuber Committed by Aaron Dees
Browse files

Add S3 error handling

All errors returned from phobos now have at least a little distinct error messages (as far as the return values permit it) and send an S3 readable XML along with the error number.
parent 4447cb00
......@@ -19,7 +19,7 @@ CASE_SENSE_NAMES = YES
# Warning options
# Warn on everything possible, and fail on warning
QUIET = NO
QUIET = YES
WARNINGS = YES
WARN_IF_UNDOCUMENTED = NO
WARN_IF_DOC_ERROR = YES
......@@ -50,4 +50,3 @@ PREDEFINED = __cplusplus
SEARCH_INCLUDES = YES
GENERATE_XML = YES
XML_NS_MEMB_FILE_SCOPE = YES
......@@ -20,6 +20,7 @@ Is inherited by [fiphoboserver::IOException][fiphoboserver-IOException], [fiphob
| [FIPhoboServerException](#fiphoboserver-FIPhoboServerException-FIPhoboServerException) | default constructor |
| [FIPhoboServerException](#fiphoboserver-FIPhoboServerException-FIPhoboServerException-1) | constructor for a message with information on the 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
#### 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:
* const
* inline
......
......@@ -8,13 +8,34 @@ exceptions specifically for errors in I/O
## Inheritance:
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
| Name | Description |
| ---- | ---- |
| [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
### <a name='fiphoboserver-IOException-IOException' /> public fiphoboserver::IOException::IOException (const char *caller, const char *function_name, int return_value)
......@@ -45,6 +66,30 @@ constructor
* 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)
[fiphoboserver-FIPhoboServerException]:./FIPhoboServerException.md
......@@ -12,13 +12,13 @@
| [HandlerFactory](./HandlerFactory.md) | factory to create the handlers for incoming HTTP requests |
| [IOException](./IOException.md) | exceptions specifically for errors in I/O |
| [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 |
## Namespaces
| 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] |
| [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
......@@ -8,18 +8,19 @@ class to extract the S3 specific information from proxygens HTTPMessage headers
## Public Functions
| Name | Description |
| ---- | ---- |
| [set_headers](#fiphoboserver-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_key_without_bucket](#fiphoboserver-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 |
| [is_create_bucket_request](#fiphoboserver-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_meta_data](#fiphoboserver-S3_header-get_meta_data) | gets the S3 metadata stored in the HTTP headers |
| [set_headers](#fiphoboserver-s3_utilities-S3_header-set_headers) | sets the internal header instance to the given header object |
| [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_utilities-S3_header-get_key_without_bucket) | 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_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_utilities-S3_header-get_body_length) | gets the total length of all body chunks that is expected |
| [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
### <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
......@@ -46,9 +47,9 @@ sets the internal header instance to the given header object
* 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
......@@ -75,9 +76,9 @@ extracts the name of the S3 bucket requested in the HTTP message
* 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
......@@ -104,9 +105,9 @@ This will only return the key itself without the leading bucket name!
* 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
......@@ -133,9 +134,9 @@ This is the whole path argument without the leading '/' but including the bucket
* 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
......@@ -162,9 +163,9 @@ This is convenient since we don't really support buckets themselves and can easi
* 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
......@@ -191,9 +192,9 @@ This reads out the header "Content-Length"
* 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
......@@ -220,5 +221,22 @@ In S3 arbitrary metadata can be defined. This has the form x-amx-meta-KEY: VALUE
* 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
## Inheritance:
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
| Name | Description |
| ---- | ---- |
| [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
### <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
* 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)
[fiphoboserver-FIPhoboServerException]:./../FIPhoboServerException.md
......@@ -84,26 +84,40 @@ default destructor
[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
#### Parameters:
| Type | Name | Description |
| ---- | ---- | ---- |
| [Phobos_file][fiphoboserver-storage-Phobos_file] && | input | |
#### Qualifiers:
* inline
[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
#### Parameters:
| Type | Name | Description |
| ---- | ---- | ---- |
| [Phobos_file][fiphoboserver-storage-Phobos_file] && | input | |
#### Returns:
| Type | Description |
| ---- | ---- |
......@@ -113,6 +127,10 @@ default assignment operator for rvalue references
#### Qualifiers:
* inline
[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
......
......@@ -26,7 +26,7 @@ paths:
get:
tags:
- bucket
summary: Lists all objects in the bucket
summary: Lists all objects in the bucket (not yet implemented)
operationId: getBucket
responses:
'200':
......@@ -37,14 +37,27 @@ paths:
$ref: '#/components/schemas/ListObjectsV2Output'
'403':
description: Access denied
content:
application/xml:
schema:
$ref: '#/components/schemas/Error'
'404':
description: No such bucket
content:
application/xml:
schema:
$ref: '#/components/schemas/Error'
'500':
description: Internal Server Error
content:
application/xml:
schema:
$ref: '#/components/schemas/Error'
put:
tags:
- bucket
summary: Creates a new bucket
summary: Creates a new bucket (not yet implemented)
operationId: putBucket
requestBody:
description: Information on the bucket that should be created
......@@ -58,8 +71,16 @@ paths:
description: Success
'403':
description: Access denied
content:
application/xml:
schema:
$ref: '#/components/schemas/Error'
'500':
description: Internal Server Error
content:
application/xml:
schema:
$ref: '#/components/schemas/Error'
'/{bucket}/{key}':
parameters:
- name: bucket
......@@ -93,10 +114,32 @@ paths:
type: string
'403':
description: Access denied
content:
application/xml:
schema:
$ref: '#/components/schemas/Error'
'404':
description: No such key
description: Not found (No such key)
content:
application/xml:
schema:
allOf:
- $ref: '#/components/schemas/Error'
- example:
Code: NoSuchKey
Message: The resource you requested does not exist!
Resource: key
'500':
description: Internal Server Error
content:
application/xml:
schema:
allOf:
- $ref: '#/components/schemas/Error'
- example:
Code: InternalServerPhobosError
Message: The Phobos database is not running correctly on the server
Resource: key
put:
tags:
- object
......@@ -123,25 +166,61 @@ paths:
description: Continue
'200':
description: Success
'400':
description: Bad Request
content:
application/xml:
schema:
allOf:
- $ref: '#/components/schemas/Error'
- example:
Code: InvalidArgument
Message: Some arguments given to the storage were invalid!
Resource: key
'403':
description: Access denied
content:
application/xml:
schema:
$ref: '#/components/schemas/Error'
'500':
description: Internal Server Error
content:
application/xml:
schema:
allOf:
- $ref: '#/components/schemas/Error'
- example:
Code: InternalServerPhobosError
Message: The Phobos database is not running correctly on the server
Resource: key
delete:
tags:
- object
summary: Delete an object
operationId: deleteObject
description: Deletes an object from the internal storage
description: Deletes an object from the internal storage (not yet implemented)
responses:
'204':
description: No Content
'403':
description: Access denied