Skip to content

Commit

Permalink
Merge pull request #124 from biocore/error_code_bugfix
Browse files Browse the repository at this point in the history
Error code bugfix
  • Loading branch information
wasade committed Apr 28, 2020
2 parents f876e6d + b45f313 commit 4c681aa
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
8 changes: 4 additions & 4 deletions microsetta_private_api/api/implementation.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ def claim_legacy_acct(token_info):
# If there exists a legacy account for the email in the token, which the
# user represented by the token does not already own but can claim, this
# claims the legacy account for the user and returns a 200 code with json
# containing an object for the claimed account. Otherwise, this returns a
# 404 code. This function can also trigger a 422 from the repo layer in the
# case of inconsistent account data.
# list containing the object for the claimed account. Otherwise, this
# returns an empty json list. This function can also trigger a 422 from the
# repo layer in the case of inconsistent account data.

email = token_info[JWT_EMAIL_CLAIM_KEY]
auth_iss = token_info[JWT_ISS_CLAIM_KEY]
Expand Down Expand Up @@ -105,7 +105,7 @@ def register_account(body, token_info):
kit_repo = KitRepo(t)
kit = kit_repo.get_kit_all_samples(body['kit_name'])
if kit is None:
return jsonify(error=404, text="Kit name not found"), 404
return jsonify(code=404, message="Kit name not found"), 404

acct_repo = AccountRepo(t)
acct_repo.create_account(account_obj)
Expand Down
14 changes: 13 additions & 1 deletion microsetta_private_api/api/microsetta_private_api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1260,10 +1260,22 @@ components:
responses:
401Unauthorized: # Can be referenced as '#/components/responses/401Unauthorized'
description: Invalid or missing token.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
403Forbidden: # Can be referenced as '#/components/responses/403Forbidden'
description: Authorization refused.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
404NotFound: # Can be referenced as '#/components/responses/404NotFound'
description: The specified resource was not found.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
422UnprocessableEntity:
description: The instructions provided cannot be processed.
content:
Expand Down Expand Up @@ -1639,7 +1651,7 @@ components:
type: object
properties:
code:
type: string
type: integer
message:
type: string
required:
Expand Down

0 comments on commit 4c681aa

Please sign in to comment.