worker/client: expose server errors

The worker API returns errors of the form:

  { "message": "..." }

Print the message of those errors when receiving an error on the client.

This adds an `Error` type to openapi.yml and marks all routes as
returning it on 4XX and 5XX.
This commit is contained in:
Lars Karlitski 2020-09-09 10:23:08 +02:00 committed by Tom Gundersen
parent 3bedd25087
commit ca35f25fcf
4 changed files with 80 additions and 13 deletions

View file

@ -23,6 +23,17 @@ paths:
- OK
required:
- status
4XX:
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
5XX:
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
operationId: GetStatus
description: Simple status handler to check whether the service is up.
/jobs:
@ -53,6 +64,17 @@ paths:
- manifest
- location
- id
4XX:
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
5XX:
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
operationId: RequestJob
requestBody:
content:
@ -85,6 +107,18 @@ paths:
type: boolean
required:
- canceled
4XX:
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
5XX:
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
operationId: GetJob
description: ''
patch:
@ -127,6 +161,17 @@ paths:
responses:
'200':
description: OK
4XX:
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
5XX:
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
operationId: UploadJobArtifact
requestBody:
content:
@ -134,4 +179,12 @@ paths:
schema:
type: string
components:
schemas: {}
schemas:
Error:
title: Error
type: object
properties:
message:
type: string
required:
- message