Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

editoast: refactor core error #11041

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
181 changes: 22 additions & 159 deletions editoast/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4256,6 +4256,25 @@ components:
description: |-
JSON-Pointer value [RFC6901](https://tools.ietf.org/html/rfc6901) that references a location
within the target document where the operation is performed.
CoreErrorResponse:
type: object
required:
- type
- context
- message
properties:
context:
type: object
additionalProperties: {}
message:
type: string
status:
type: integer
format: int32
maximum: 599
minimum: 100
type:
type: string
Curve:
type: object
required:
Expand Down Expand Up @@ -4749,155 +4768,6 @@ components:
type: string
enum:
- editoast:cache_operation:ObjectNotFound
EditoastCoreErrorBrokenPipe:
type: object
required:
- type
- status
- message
properties:
context:
type: object
message:
type: string
status:
type: integer
enum:
- 500
type:
type: string
enum:
- editoast:coreclient:BrokenPipe
EditoastCoreErrorConnectionClosedBeforeMessageCompleted:
type: object
required:
- type
- status
- message
properties:
context:
type: object
message:
type: string
status:
type: integer
enum:
- 500
type:
type: string
enum:
- editoast:coreclient:ConnectionClosedBeforeMessageCompleted
EditoastCoreErrorConnectionResetByPeer:
type: object
required:
- type
- status
- message
properties:
context:
type: object
message:
type: string
status:
type: integer
enum:
- 500
type:
type: string
enum:
- editoast:coreclient:ConnectionResetByPeer
EditoastCoreErrorCoreResponseFormatError:
type: object
required:
- type
- status
- message
properties:
context:
type: object
required:
- msg
properties:
msg:
type: string
message:
type: string
status:
type: integer
enum:
- 500
type:
type: string
enum:
- editoast:coreclient:CoreResponseFormatError
EditoastCoreErrorGenericCoreError:
type: object
required:
- type
- status
- message
properties:
context:
type: object
required:
- raw_error
- status
- url
properties:
raw_error:
type: string
status:
type: object
url:
type: string
message:
type: string
status:
type: integer
enum:
- 400
type:
type: string
enum:
- editoast:coreclient:GenericCoreError
EditoastCoreErrorMqClientError:
type: object
required:
- type
- status
- message
properties:
context:
type: object
message:
type: string
status:
type: integer
enum:
- 500
type:
type: string
enum:
- editoast:coreclient:MqClientError
EditoastCoreErrorUnparsableErrorOutput:
type: object
required:
- type
- status
- message
properties:
context:
type: object
message:
type: string
status:
type: integer
enum:
- 400
type:
type: string
enum:
- editoast:coreclient:UnparsableErrorOutput
EditoastDatabaseAccessErrorDatabaseAccessError:
type: object
required:
Expand Down Expand Up @@ -5106,13 +4976,6 @@ components:
- $ref: '#/components/schemas/EditoastAutoFixesEditoastErrorMissingErrorObject'
- $ref: '#/components/schemas/EditoastCacheOperationErrorDuplicateIdsProvided'
- $ref: '#/components/schemas/EditoastCacheOperationErrorObjectNotFound'
- $ref: '#/components/schemas/EditoastCoreErrorBrokenPipe'
- $ref: '#/components/schemas/EditoastCoreErrorConnectionClosedBeforeMessageCompleted'
- $ref: '#/components/schemas/EditoastCoreErrorConnectionResetByPeer'
- $ref: '#/components/schemas/EditoastCoreErrorCoreResponseFormatError'
- $ref: '#/components/schemas/EditoastCoreErrorGenericCoreError'
- $ref: '#/components/schemas/EditoastCoreErrorMqClientError'
- $ref: '#/components/schemas/EditoastCoreErrorUnparsableErrorOutput'
- $ref: '#/components/schemas/EditoastDatabaseAccessErrorDatabaseAccessError'
- $ref: '#/components/schemas/EditoastDelimitedAreaErrorInvalidLocations'
- $ref: '#/components/schemas/EditoastDocumentErrorsDatabase'
Expand Down Expand Up @@ -8945,7 +8808,7 @@ components:
- failed_status
properties:
core_error:
$ref: '#/components/schemas/InternalError'
$ref: '#/components/schemas/CoreErrorResponse'
failed_status:
type: string
enum:
Expand Down Expand Up @@ -11088,7 +10951,7 @@ components:
- status
properties:
core_error:
$ref: '#/components/schemas/InternalError'
$ref: '#/components/schemas/CoreErrorResponse'
status:
type: string
enum:
Expand Down Expand Up @@ -11168,7 +11031,7 @@ components:
- status
properties:
core_error:
$ref: '#/components/schemas/InternalError'
$ref: '#/components/schemas/CoreErrorResponse'
status:
type: string
enum:
Expand Down
4 changes: 1 addition & 3 deletions editoast/src/core/mocking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ impl From<MockingClient> for CoreClient {
#[derive(Debug)]
pub struct MockingError {
pub bytes: Vec<u8>,
pub status: StatusCode,
pub url: String,
}

Expand Down Expand Up @@ -96,13 +95,12 @@ impl MockingClient {
)
.expect("mocked response body should deserialize faultlessly"),
)),
Some(StubResponse { code, .. }) => {
Some(StubResponse { .. }) => {
let err = response
.expect("mocked response body should not be empty when specified")
.to_vec();
Err(MockingError {
bytes: err,
status: code,
url: req_path,
})
}
Expand Down
Loading
Loading