<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/docker.git/api/server/httputils/errors.go, branch master</title>
<subtitle>github.com: dotcloud/docker.git
</subtitle>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/docker.git/'/>
<entry>
<title>Move httputils error helpers to errdefs package</title>
<updated>2019-03-15T23:42:23+00:00</updated>
<author>
<name>Sebastiaan van Stijn</name>
<email>github@gone.nl</email>
</author>
<published>2019-02-09T14:53:29+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/docker.git/commit/?id=2a9c987e5a72549775ffa4dc31595ceff4f06a78'/>
<id>2a9c987e5a72549775ffa4dc31595ceff4f06a78</id>
<content type='text'>
Signed-off-by: Sebastiaan van Stijn &lt;github@gone.nl&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Sebastiaan van Stijn &lt;github@gone.nl&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Add httputils.FromStatusCode()</title>
<updated>2019-03-15T23:39:48+00:00</updated>
<author>
<name>Sebastiaan van Stijn</name>
<email>github@gone.nl</email>
</author>
<published>2018-12-31T12:59:59+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/docker.git/commit/?id=1af30c50ca0ad81e2839ff4f2c5e70413f021d52'/>
<id>1af30c50ca0ad81e2839ff4f2c5e70413f021d52</id>
<content type='text'>
This utility allows a client to convert an API response
back to a typed error; allowing the client to perform
different actions based on the type of error, without
having to resort to string-matching the error.

Signed-off-by: Sebastiaan van Stijn &lt;github@gone.nl&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This utility allows a client to convert an API response
back to a typed error; allowing the client to perform
different actions based on the type of error, without
having to resort to string-matching the error.

Signed-off-by: Sebastiaan van Stijn &lt;github@gone.nl&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Handle correct status codes for distribution errors</title>
<updated>2019-02-08T09:35:36+00:00</updated>
<author>
<name>Sebastiaan van Stijn</name>
<email>github@gone.nl</email>
</author>
<published>2018-08-03T14:41:47+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/docker.git/commit/?id=cdcea6f492f8554086726037ca91f213e7101669'/>
<id>cdcea6f492f8554086726037ca91f213e7101669</id>
<content type='text'>
This assists to address a regression where distribution errors were not properly
handled, resulting in a generic 500 (internal server error) to be returned for
`/distribution/name/json` if you weren't authenticated, whereas it should return
a 40x (401).

This patch attempts to extract the HTTP status-code that was returned by the
distribution code, and falls back to returning a 500 status if unable to match.

Before this change:

    curl -v --unix-socket /var/run/docker.sock http://localhost/distribution/name/json
    *   Trying /var/run/docker.sock...
    * Connected to localhost (/var/run/docker.sock) port 80 (#0)
    &gt; GET /distribution/name/json HTTP/1.1
    &gt; Host: localhost
    &gt; User-Agent: curl/7.52.1
    &gt; Accept: */*
    &gt;
    &lt; HTTP/1.1 500 Internal Server Error
    &lt; Api-Version: 1.37
    &lt; Content-Type: application/json
    &lt; Docker-Experimental: false
    &lt; Ostype: linux
    &lt; Server: Docker/dev (linux)
    &lt; Date: Tue, 03 Jul 2018 15:52:53 GMT
    &lt; Content-Length: 115
    &lt;
    {"message":"errors:\ndenied: requested access to the resource is denied\nunauthorized: authentication required\n"}
    * Curl_http_done: called premature == 0
    * Connection #0 to host localhost left intact

daemon logs:

    DEBU[2018-07-03T15:52:51.424950601Z] Calling GET /distribution/name/json
    DEBU[2018-07-03T15:52:53.179895572Z] FIXME: Got an API for which error does not match any expected type!!!: errors:
    denied: requested access to the resource is denied
    unauthorized: authentication required
      error_type=errcode.Errors module=api
    ERRO[2018-07-03T15:52:53.179942783Z] Handler for GET /distribution/name/json returned error: errors:
    denied: requested access to the resource is denied
    unauthorized: authentication required

With this patch applied:

    curl -v --unix-socket /var/run/docker.sock http://localhost/distribution/name/json
    *   Trying /var/run/docker.sock...
    * Connected to localhost (/var/run/docker.sock) port 80 (#0)
    &gt; GET /distribution/name/json HTTP/1.1
    &gt; Host: localhost
    &gt; User-Agent: curl/7.52.1
    &gt; Accept: */*
    &gt;
    &lt; HTTP/1.1 403 Forbidden
    &lt; Api-Version: 1.38
    &lt; Content-Type: application/json
    &lt; Docker-Experimental: false
    &lt; Ostype: linux
    &lt; Server: Docker/dev (linux)
    &lt; Date: Fri, 03 Aug 2018 14:58:09 GMT
    &lt; Content-Length: 115
    &lt;
    {"message":"errors:\ndenied: requested access to the resource is denied\nunauthorized: authentication required\n"}
    * Curl_http_done: called premature == 0
    * Connection #0 to host localhost left intact

daemon logs:

    DEBU[2018-08-03T14:58:08.018726228Z] Calling GET /distribution/name/json

Signed-off-by: Sebastiaan van Stijn &lt;github@gone.nl&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This assists to address a regression where distribution errors were not properly
handled, resulting in a generic 500 (internal server error) to be returned for
`/distribution/name/json` if you weren't authenticated, whereas it should return
a 40x (401).

This patch attempts to extract the HTTP status-code that was returned by the
distribution code, and falls back to returning a 500 status if unable to match.

Before this change:

    curl -v --unix-socket /var/run/docker.sock http://localhost/distribution/name/json
    *   Trying /var/run/docker.sock...
    * Connected to localhost (/var/run/docker.sock) port 80 (#0)
    &gt; GET /distribution/name/json HTTP/1.1
    &gt; Host: localhost
    &gt; User-Agent: curl/7.52.1
    &gt; Accept: */*
    &gt;
    &lt; HTTP/1.1 500 Internal Server Error
    &lt; Api-Version: 1.37
    &lt; Content-Type: application/json
    &lt; Docker-Experimental: false
    &lt; Ostype: linux
    &lt; Server: Docker/dev (linux)
    &lt; Date: Tue, 03 Jul 2018 15:52:53 GMT
    &lt; Content-Length: 115
    &lt;
    {"message":"errors:\ndenied: requested access to the resource is denied\nunauthorized: authentication required\n"}
    * Curl_http_done: called premature == 0
    * Connection #0 to host localhost left intact

daemon logs:

    DEBU[2018-07-03T15:52:51.424950601Z] Calling GET /distribution/name/json
    DEBU[2018-07-03T15:52:53.179895572Z] FIXME: Got an API for which error does not match any expected type!!!: errors:
    denied: requested access to the resource is denied
    unauthorized: authentication required
      error_type=errcode.Errors module=api
    ERRO[2018-07-03T15:52:53.179942783Z] Handler for GET /distribution/name/json returned error: errors:
    denied: requested access to the resource is denied
    unauthorized: authentication required

With this patch applied:

    curl -v --unix-socket /var/run/docker.sock http://localhost/distribution/name/json
    *   Trying /var/run/docker.sock...
    * Connected to localhost (/var/run/docker.sock) port 80 (#0)
    &gt; GET /distribution/name/json HTTP/1.1
    &gt; Host: localhost
    &gt; User-Agent: curl/7.52.1
    &gt; Accept: */*
    &gt;
    &lt; HTTP/1.1 403 Forbidden
    &lt; Api-Version: 1.38
    &lt; Content-Type: application/json
    &lt; Docker-Experimental: false
    &lt; Ostype: linux
    &lt; Server: Docker/dev (linux)
    &lt; Date: Fri, 03 Aug 2018 14:58:09 GMT
    &lt; Content-Length: 115
    &lt;
    {"message":"errors:\ndenied: requested access to the resource is denied\nunauthorized: authentication required\n"}
    * Curl_http_done: called premature == 0
    * Connection #0 to host localhost left intact

daemon logs:

    DEBU[2018-08-03T14:58:08.018726228Z] Calling GET /distribution/name/json

Signed-off-by: Sebastiaan van Stijn &lt;github@gone.nl&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Replace deprecated grpc.ErrorDesc() and grpc.Code() calls</title>
<updated>2018-12-30T11:34:28+00:00</updated>
<author>
<name>Sebastiaan van Stijn</name>
<email>github@gone.nl</email>
</author>
<published>2018-12-28T23:24:26+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/docker.git/commit/?id=72b0b0387d777328882b02224bb78ad59c0837e3'/>
<id>72b0b0387d777328882b02224bb78ad59c0837e3</id>
<content type='text'>
Signed-off-by: Sebastiaan van Stijn &lt;github@gone.nl&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Sebastiaan van Stijn &lt;github@gone.nl&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Add canonical import comment</title>
<updated>2018-02-05T21:51:57+00:00</updated>
<author>
<name>Daniel Nephin</name>
<email>dnephin@docker.com</email>
</author>
<published>2018-02-05T21:05:59+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/docker.git/commit/?id=4f0d95fa6ee7f865597c03b9e63702cdcb0f7067'/>
<id>4f0d95fa6ee7f865597c03b9e63702cdcb0f7067</id>
<content type='text'>
Signed-off-by: Daniel Nephin &lt;dnephin@docker.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Daniel Nephin &lt;dnephin@docker.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Move api/errdefs to errdefs</title>
<updated>2018-01-12T02:21:43+00:00</updated>
<author>
<name>Brian Goff</name>
<email>cpuguy83@gmail.com</email>
</author>
<published>2018-01-11T19:53:06+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/docker.git/commit/?id=d453fe35b9b8b52d0677fe0c3cc8373f2f5d30d0'/>
<id>d453fe35b9b8b52d0677fe0c3cc8373f2f5d30d0</id>
<content type='text'>
Signed-off-by: Brian Goff &lt;cpuguy83@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Brian Goff &lt;cpuguy83@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Add helpers to create errdef errors</title>
<updated>2018-01-12T02:21:43+00:00</updated>
<author>
<name>Brian Goff</name>
<email>cpuguy83@gmail.com</email>
</author>
<published>2017-11-29T04:09:37+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/docker.git/commit/?id=87a12421a94faac294079bebc97c8abb4180dde5'/>
<id>87a12421a94faac294079bebc97c8abb4180dde5</id>
<content type='text'>
Instead of having to create a bunch of custom error types that are doing
nothing but wrapping another error in sub-packages, use a common helper
to create errors of the requested type.

e.g. instead of re-implementing this over and over:

```go
type notFoundError struct {
  cause error
}

func(e notFoundError) Error() string {
  return e.cause.Error()
}

func(e notFoundError) NotFound() {}

func(e notFoundError) Cause() error {
  return e.cause
}
```

Packages can instead just do:

```
  errdefs.NotFound(err)
```

Signed-off-by: Brian Goff &lt;cpuguy83@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Instead of having to create a bunch of custom error types that are doing
nothing but wrapping another error in sub-packages, use a common helper
to create errors of the requested type.

e.g. instead of re-implementing this over and over:

```go
type notFoundError struct {
  cause error
}

func(e notFoundError) Error() string {
  return e.cause.Error()
}

func(e notFoundError) NotFound() {}

func(e notFoundError) Cause() error {
  return e.cause
}
```

Packages can instead just do:

```
  errdefs.NotFound(err)
```

Signed-off-by: Brian Goff &lt;cpuguy83@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Add deadcode linter</title>
<updated>2017-08-21T22:18:50+00:00</updated>
<author>
<name>Daniel Nephin</name>
<email>dnephin@docker.com</email>
</author>
<published>2017-08-21T21:51:45+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/docker.git/commit/?id=62c1f0ef41e6cd88a8846da1c11976a320ca8b41'/>
<id>62c1f0ef41e6cd88a8846da1c11976a320ca8b41</id>
<content type='text'>
Signed-off-by: Daniel Nephin &lt;dnephin@docker.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Daniel Nephin &lt;dnephin@docker.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Remove string checking in API error handling</title>
<updated>2017-08-15T20:01:11+00:00</updated>
<author>
<name>Brian Goff</name>
<email>cpuguy83@gmail.com</email>
</author>
<published>2017-07-19T14:20:13+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/docker.git/commit/?id=ebcb7d6b406fe50ea9a237c73004d75884184c33'/>
<id>ebcb7d6b406fe50ea9a237c73004d75884184c33</id>
<content type='text'>
Use strongly typed errors to set HTTP status codes.
Error interfaces are defined in the api/errors package and errors
returned from controllers are checked against these interfaces.

Errors can be wraeped in a pkg/errors.Causer, as long as somewhere in the
line of causes one of the interfaces is implemented. The special error
interfaces take precedence over Causer, meaning if both Causer and one
of the new error interfaces are implemented, the Causer is not
traversed.

Signed-off-by: Brian Goff &lt;cpuguy83@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Use strongly typed errors to set HTTP status codes.
Error interfaces are defined in the api/errors package and errors
returned from controllers are checked against these interfaces.

Errors can be wraeped in a pkg/errors.Causer, as long as somewhere in the
line of causes one of the interfaces is implemented. The special error
interfaces take precedence over Causer, meaning if both Causer and one
of the new error interfaces are implemented, the Causer is not
traversed.

Signed-off-by: Brian Goff &lt;cpuguy83@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Update logrus to v1.0.1</title>
<updated>2017-07-31T20:16:46+00:00</updated>
<author>
<name>Derek McGowan</name>
<email>derek@mcgstyle.net</email>
</author>
<published>2017-07-26T21:42:13+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/docker.git/commit/?id=1009e6a40b295187e038b67e184e9c0384d95538'/>
<id>1009e6a40b295187e038b67e184e9c0384d95538</id>
<content type='text'>
Fixes case sensitivity issue

Signed-off-by: Derek McGowan &lt;derek@mcgstyle.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fixes case sensitivity issue

Signed-off-by: Derek McGowan &lt;derek@mcgstyle.net&gt;
</pre>
</div>
</content>
</entry>
</feed>
