mirror of
https://github.com/mariadb-corporation/libmarias3.git
synced 2025-04-18 16:24:01 +03:00
parent
b1e256cbd4
commit
8176772266
@ -1,30 +1,30 @@
|
||||
Error Codes
|
||||
===========
|
||||
|
||||
+------+------------------------------------------------------+
|
||||
| Code | Details |
|
||||
+======+======================================================+
|
||||
| 0 | Success |
|
||||
+------+------------------------------------------------------+
|
||||
| 1 | A required function parameter is missing |
|
||||
+------+------------------------------------------------------+
|
||||
| 2 | No data is supplied to a function that requires data |
|
||||
+------+------------------------------------------------------+
|
||||
| 3 | The generated URI for the request is too long |
|
||||
+------+------------------------------------------------------+
|
||||
| 4 | The API could not parse the response from S3 |
|
||||
+------+------------------------------------------------------+
|
||||
| 5 | The API could not send the request to S3 |
|
||||
+------+------------------------------------------------------+
|
||||
| 6 | Could not allocate required memory |
|
||||
+------+------------------------------------------------------+
|
||||
| 7 | A theortically impossible condition occurred |
|
||||
+------+------------------------------------------------------+
|
||||
| 8 | Authentication failed |
|
||||
+------+------------------------------------------------------+
|
||||
| 9 | Object not found |
|
||||
+------+------------------------------------------------------+
|
||||
| 10 | Unknown error code in S3 response |
|
||||
+------+------------------------------------------------------+
|
||||
| 11 | PUT data is too large, 4GB maximum |
|
||||
+------+------------------------------------------------------+
|
||||
+------------------------+------------------------------------------------------+
|
||||
| Code | Details |
|
||||
+========================+======================================================+
|
||||
| MS3_ERR_NONE | Success (always equal to ``0``) |
|
||||
+------------------------+------------------------------------------------------+
|
||||
| MS3_ERR_PARAMETER | A required function parameter is missing |
|
||||
+------------------------+------------------------------------------------------+
|
||||
| MS3_ERR_NO_DATA | No data is supplied to a function that requires data |
|
||||
+------------------------+------------------------------------------------------+
|
||||
| MS3_ERR_URI_TOO_LONG | The generated URI for the request is too long |
|
||||
+------------------------+------------------------------------------------------+
|
||||
| MS3_ERR_RESPONSE_PARSE | The API could not parse the response from S3 |
|
||||
+------------------------+------------------------------------------------------+
|
||||
| MS3_ERR_REQUEST_ERROR | The API could not send the request to S3 |
|
||||
+------------------------+------------------------------------------------------+
|
||||
| MS3_ERR_OOM | Could not allocate required memory |
|
||||
+------------------------+------------------------------------------------------+
|
||||
| MS3_ERR_IMPOSSIBLE | A theortically impossible condition occurred |
|
||||
+------------------------+------------------------------------------------------+
|
||||
| MS3_ERR_AUTH | Authentication failed |
|
||||
+------------------------+------------------------------------------------------+
|
||||
| MS3_ERR_NOT_FOUND | Object not found |
|
||||
+------------------------+------------------------------------------------------+
|
||||
| MS3_ERR_SERVER | Unknown error code in S3 response |
|
||||
+------------------------+------------------------------------------------------+
|
||||
| MS3_ERR_TOO_BIG | PUT data is too large, 4GB maximum |
|
||||
+------------------------+------------------------------------------------------+
|
||||
|
0
extra/astyle.sh
Normal file → Executable file
0
extra/astyle.sh
Normal file → Executable file
@ -46,6 +46,23 @@ struct ms3_status_st
|
||||
|
||||
typedef struct ms3_status_st ms3_status_st;
|
||||
|
||||
enum MS3_ERROR_CODES
|
||||
{
|
||||
MS3_ERR_NONE,
|
||||
MS3_ERR_PARAMETER,
|
||||
MS3_ERR_NO_DATA,
|
||||
MS3_ERR_URI_TOO_LONG,
|
||||
MS3_ERR_RESPONSE_PARSE,
|
||||
MS3_ERR_REQUEST_ERROR,
|
||||
MS3_ERR_OOM,
|
||||
MS3_ERR_IMPOSSIBLE,
|
||||
MS3_ERR_AUTH,
|
||||
MS3_ERR_NOT_FOUND,
|
||||
MS3_ERR_SERVER,
|
||||
MS3_ERR_TOO_BIG,
|
||||
MS3_ERR_MAX // Always the last error
|
||||
};
|
||||
|
||||
MS3_API
|
||||
ms3_st *ms3_init(const char *s3key, const char *s3secret, const char *region,
|
||||
const char *base_domain);
|
||||
|
@ -20,6 +20,8 @@
|
||||
#include "config.h"
|
||||
#include "common.h"
|
||||
|
||||
// NOTE: for every new error, add an entry to errmsgs here
|
||||
|
||||
const char *errmsgs[] =
|
||||
{
|
||||
"No error",
|
||||
|
18
src/error.h
18
src/error.h
@ -21,24 +21,6 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
// NOTE: for every new error, add an entry to errmsgs in error.c
|
||||
enum MS3_ERROR_CODES
|
||||
{
|
||||
MS3_ERR_NONE,
|
||||
MS3_ERR_PARAMETER,
|
||||
MS3_ERR_NO_DATA,
|
||||
MS3_ERR_URI_TOO_LONG,
|
||||
MS3_ERR_RESPONSE_PARSE,
|
||||
MS3_ERR_REQUEST_ERROR,
|
||||
MS3_ERR_OOM,
|
||||
MS3_ERR_IMPOSSIBLE,
|
||||
MS3_ERR_AUTH,
|
||||
MS3_ERR_NOT_FOUND,
|
||||
MS3_ERR_SERVER,
|
||||
MS3_ERR_TOO_BIG,
|
||||
MS3_ERR_MAX // Always the last error
|
||||
};
|
||||
|
||||
#define baderror "No such error code"
|
||||
|
||||
// extern and define in C file so we don't get redefinition at link time
|
||||
|
@ -110,6 +110,7 @@ uint8_t parse_list_response(const char *data, size_t length, ms3_list_st **list)
|
||||
{
|
||||
nextptr->key = NULL;
|
||||
}
|
||||
|
||||
nextptr->length = size;
|
||||
nextptr->created = tout;
|
||||
}
|
||||
|
@ -41,6 +41,6 @@ int main(int argc, char *argv[])
|
||||
ASSERT_STREQ(errmsg, "No error");
|
||||
uint8_t res = ms3_get(ms3, "bad", "bad/file.txt", &data, &length);
|
||||
printf("%d\n", res);
|
||||
ASSERT_EQ(res, 8); // Bad auth
|
||||
ASSERT_EQ(res, MS3_ERR_AUTH); // Bad auth
|
||||
ms3_deinit(ms3);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user