Initial commit
This commit is contained in:
56
skills/skill-adapter/assets/error_response_template.json
Normal file
56
skills/skill-adapter/assets/error_response_template.json
Normal file
@@ -0,0 +1,56 @@
|
||||
{
|
||||
"_comment": "Template for a standardized error response.",
|
||||
"error": {
|
||||
"_comment": "Top-level key indicating an error occurred.",
|
||||
"code": "ERR_INVALID_INPUT",
|
||||
"_comment": "A unique error code for programmatic handling. Should be stable and not change even if the message changes.",
|
||||
"message": "Invalid input provided.",
|
||||
"_comment": "A human-readable error message. Should be helpful to the user.",
|
||||
"status": 400,
|
||||
"_comment": "The HTTP status code associated with the error.",
|
||||
"details": {
|
||||
"_comment": "Optional details about the error. Can be an object or an array.",
|
||||
"field": "email",
|
||||
"issue": "Email address is not valid."
|
||||
},
|
||||
"timestamp": "2024-10-27T10:00:00Z",
|
||||
"_comment": "Timestamp of when the error occurred (ISO 8601 format)."
|
||||
},
|
||||
"_comment": "Example of a different error scenario (Internal Server Error)",
|
||||
"example_internal_server_error": {
|
||||
"error": {
|
||||
"code": "ERR_INTERNAL_SERVER_ERROR",
|
||||
"message": "An unexpected error occurred on the server.",
|
||||
"status": 500,
|
||||
"details": {
|
||||
"_comment": "This can be omitted or contain sensitive information that should not be exposed to the client.",
|
||||
"errorId": "a1b2c3d4e5f6g7h8"
|
||||
},
|
||||
"timestamp": "2024-10-27T10:01:00Z"
|
||||
}
|
||||
},
|
||||
"_comment": "Example of a different error scenario (Unauthorized)",
|
||||
"example_unauthorized": {
|
||||
"error": {
|
||||
"code": "ERR_UNAUTHORIZED",
|
||||
"message": "Unauthorized: Invalid credentials.",
|
||||
"status": 401,
|
||||
"details": null,
|
||||
"_comment": "Details are often omitted for unauthorized errors.",
|
||||
"timestamp": "2024-10-27T10:02:00Z"
|
||||
}
|
||||
},
|
||||
"_comment": "Example of a different error scenario (Not Found)",
|
||||
"example_not_found": {
|
||||
"error": {
|
||||
"code": "ERR_NOT_FOUND",
|
||||
"message": "Resource not found.",
|
||||
"status": 404,
|
||||
"details": {
|
||||
"resource": "user",
|
||||
"id": "123"
|
||||
},
|
||||
"timestamp": "2024-10-27T10:03:00Z"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user