Skip to content

Commit

Permalink
Update unsupported backends response code (400) (#997)
Browse files Browse the repository at this point in the history
* Update unsupported backends response code (400)

- Compliance Test: https://github.com/elixir-cloud-aai/openapi-test-runner/blob/dev/tests/create_task_backend_parameters_negative.yml#L32-L35

* Update nextflow.yaml

* Update tests.yaml
  • Loading branch information
lbeckman314 authored Jul 24, 2024
1 parent 7639f22 commit 2ea5610
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/nextflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ jobs:
path: funnel

- name: Start Funnel
working-directory:
run: |
cd funnel/
chmod +x ./funnel
Expand All @@ -44,7 +43,7 @@ jobs:
- name: Install Nextflow
run: |
cd ..
git clone https://github.com/nextflow-io/nextflow/ -b tes-update-1.1
git clone https://github.com/nextflow-io/nextflow
cd nextflow
make compile
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ jobs:
uses: golangci/golangci-lint-action@v3
with:
version: latest
args: --timeout 3m --verbose -D unused -D errcheck -D staticcheck -D govet -D gosimple -D ineffassign
# TODO: Re-enable all linters
args: --timeout 3m --verbose -D unused -D errcheck -D staticcheck -D govet -D gosimple -D ineffassign -D typecheck

build:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -138,4 +139,4 @@ jobs:
make start-generic-s3
sleep 10
make test-generic-s3
8 changes: 6 additions & 2 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,17 @@ func customErrorHandler(ctx context.Context, mux *runtime.ServeMux, marshaler ru
w.WriteHeader(http.StatusForbidden) // 403
case codes.NotFound:
// Special case for missing tasks (TES Compliance Suite)
if (strings.Contains(st.Message(), "task not found")) {
if strings.Contains(st.Message(), "task not found") {
w.WriteHeader(http.StatusInternalServerError) // 500
} else {
w.WriteHeader(http.StatusNotFound) // 404
}
default:
w.WriteHeader(http.StatusInternalServerError) // 500
if strings.Contains(st.Message(), "backend parameters not supported") {
w.WriteHeader(http.StatusBadRequest) // 400
} else {
w.WriteHeader(http.StatusInternalServerError) // 500
}
}

// Write the error message
Expand Down

0 comments on commit 2ea5610

Please sign in to comment.