code: func statusCodeFromDistributionError(err error) int {
  	switch errs := err.(type) {
  	case errcode.Errors:
  		if len(errs) < 1 {
  			return http.StatusInternalServerError
  		}
  		if _, ok := errs[0].(errcode.ErrorCoder); ok {
  			return statusCodeFromDistributionError(errs[0])
  		}
  	case errcode.ErrorCoder:
  		return errs.ErrorCode().Descriptor().HTTPStatusCode
  	default:
  		if e, ok := err.(causer); ok {
  			return statusCodeFromDistributionError(e.Cause())
  		}
  	}
  	return http.StatusInternalServerError
  }
docs: // statusCodeFromDistributionError returns status code according to registry errcode
  // code is loosely based on errcode.ServeJSON() in docker/distribution