Skip to content

API should return 404 when the resource does not exist #6

@spesnova

Description

@spesnova

WHAT is this

Because of iruka is prototype, the API returns an error message like for now:

$ curl localhost:3000/api/v1-alpha/apps/hello
"No such app: hello"
$ curl localhost:3000/api/v1-alpha/apps/hello/containers
"No such app: hello"

But it should return 404 instead of the error message.

WHY this is problem

Returning the message causes following error when I'm using the CLI:

$ iruka apps
No apps to list
$ iruka ps --app hello
json: cannot unmarshal string into Go value of type []schema.Container

# same as `$ iruka ps --app hello`
$ curl -s -X GET localhost:3000/api/v1-alpha/apps/hello/containers
"No such app: hello"

HOW to solve it

I think I need to create registry errors.

  1. registry returns error code and message if the resource does not exist
  2. controller handle the error and returns 404 to client

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions