Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mybee
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
mybee
Commits
16551b8d
Unverified
Commit
16551b8d
authored
Jun 10, 2021
by
aloknerurkar
Committed by
GitHub
Jun 10, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: api errors related to postage stamps (#2037)
parent
388256b1
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
56 additions
and
6 deletions
+56
-6
Swarm.yaml
openapi/Swarm.yaml
+8
-0
SwarmCommon.yaml
openapi/SwarmCommon.yaml
+6
-0
bytes.go
pkg/api/bytes.go
+8
-1
bzz.go
pkg/api/bzz.go
+13
-2
chunk.go
pkg/api/chunk.go
+7
-1
dirs.go
pkg/api/dirs.go
+7
-1
pss.go
pkg/api/pss.go
+7
-1
No files found.
openapi/Swarm.yaml
View file @
16551b8d
...
...
@@ -59,6 +59,8 @@ paths:
$ref
:
"
SwarmCommon.yaml#/components/schemas/ReferenceResponse"
"
400"
:
$ref
:
"
SwarmCommon.yaml#/components/responses/400"
"
402"
:
$ref
:
"
SwarmCommon.yaml#/components/responses/402"
"
403"
:
$ref
:
"
SwarmCommon.yaml#/components/responses/403"
"
500"
:
...
...
@@ -153,6 +155,8 @@ paths:
$ref
:
"
SwarmCommon.yaml#/components/schemas/Status"
"
400"
:
$ref
:
"
SwarmCommon.yaml#/components/responses/400"
"
402"
:
$ref
:
"
SwarmCommon.yaml#/components/responses/402"
"
500"
:
$ref
:
"
SwarmCommon.yaml#/components/responses/500"
default
:
...
...
@@ -216,6 +220,8 @@ paths:
$ref
:
"
SwarmCommon.yaml#/components/schemas/ReferenceResponse"
"
400"
:
$ref
:
"
SwarmCommon.yaml#/components/responses/400"
"
402"
:
$ref
:
"
SwarmCommon.yaml#/components/responses/402"
"
403"
:
$ref
:
"
SwarmCommon.yaml#/components/responses/403"
"
500"
:
...
...
@@ -589,6 +595,8 @@ paths:
description
:
Subscribed to topic
"
400"
:
$ref
:
"
SwarmCommon.yaml#/components/responses/400"
"
402"
:
$ref
:
"
SwarmCommon.yaml#/components/responses/402"
"
500"
:
$ref
:
"
SwarmCommon.yaml#/components/responses/500"
default
:
...
...
openapi/SwarmCommon.yaml
View file @
16551b8d
...
...
@@ -575,6 +575,12 @@ components:
application/problem+json
:
schema
:
$ref
:
"
#/components/schemas/ProblemDetails"
"
402"
:
description
:
Payment Required
content
:
application/problem+json
:
schema
:
$ref
:
"
#/components/schemas/ProblemDetails"
"
403"
:
description
:
Forbidden
content
:
...
...
pkg/api/bytes.go
View file @
16551b8d
...
...
@@ -5,11 +5,13 @@
package
api
import
(
"errors"
"fmt"
"net/http"
"strings"
"github.com/ethersphere/bee/pkg/jsonhttp"
"github.com/ethersphere/bee/pkg/postage"
"github.com/ethersphere/bee/pkg/sctx"
"github.com/ethersphere/bee/pkg/swarm"
"github.com/ethersphere/bee/pkg/tags"
...
...
@@ -70,7 +72,12 @@ func (s *server) bytesUploadHandler(w http.ResponseWriter, r *http.Request) {
if
err
!=
nil
{
logger
.
Debugf
(
"bytes upload: split write all: %v"
,
err
)
logger
.
Error
(
"bytes upload: split write all"
)
switch
{
case
errors
.
Is
(
err
,
postage
.
ErrBucketFull
)
:
jsonhttp
.
PaymentRequired
(
w
,
"batch is overissued"
)
default
:
jsonhttp
.
InternalServerError
(
w
,
nil
)
}
return
}
...
...
pkg/api/bzz.go
View file @
16551b8d
...
...
@@ -24,6 +24,7 @@ import (
"github.com/ethersphere/bee/pkg/file/loadsave"
"github.com/ethersphere/bee/pkg/jsonhttp"
"github.com/ethersphere/bee/pkg/manifest"
"github.com/ethersphere/bee/pkg/postage"
"github.com/ethersphere/bee/pkg/sctx"
"github.com/ethersphere/bee/pkg/storage"
"github.com/ethersphere/bee/pkg/swarm"
...
...
@@ -119,7 +120,12 @@ func (s *server) fileUploadHandler(w http.ResponseWriter, r *http.Request, store
if
err
!=
nil
{
logger
.
Debugf
(
"bzz upload file: file store, file %q: %v"
,
fileName
,
err
)
logger
.
Errorf
(
"bzz upload file: file store, file %q"
,
fileName
)
switch
{
case
errors
.
Is
(
err
,
postage
.
ErrBucketFull
)
:
jsonhttp
.
PaymentRequired
(
w
,
"batch is overissued"
)
default
:
jsonhttp
.
InternalServerError
(
w
,
errFileStore
)
}
return
}
...
...
@@ -186,7 +192,12 @@ func (s *server) fileUploadHandler(w http.ResponseWriter, r *http.Request, store
if
err
!=
nil
{
logger
.
Debugf
(
"bzz upload file: manifest store, file %q: %v"
,
fileName
,
err
)
logger
.
Errorf
(
"bzz upload file: manifest store, file %q"
,
fileName
)
switch
{
case
errors
.
Is
(
err
,
postage
.
ErrBucketFull
)
:
jsonhttp
.
PaymentRequired
(
w
,
"batch is overissued"
)
default
:
jsonhttp
.
InternalServerError
(
w
,
nil
)
}
return
}
logger
.
Debugf
(
"Manifest Reference: %s"
,
manifestReference
.
String
())
...
...
pkg/api/chunk.go
View file @
16551b8d
...
...
@@ -17,6 +17,7 @@ import (
"github.com/ethersphere/bee/pkg/netstore"
"github.com/ethersphere/bee/pkg/jsonhttp"
"github.com/ethersphere/bee/pkg/postage"
"github.com/ethersphere/bee/pkg/sctx"
"github.com/ethersphere/bee/pkg/storage"
"github.com/ethersphere/bee/pkg/swarm"
...
...
@@ -104,7 +105,12 @@ func (s *server) chunkUploadHandler(w http.ResponseWriter, r *http.Request) {
if
err
!=
nil
{
s
.
logger
.
Debugf
(
"chunk upload: chunk write error: %v, addr %s"
,
err
,
chunk
.
Address
())
s
.
logger
.
Error
(
"chunk upload: chunk write error"
)
jsonhttp
.
BadRequest
(
w
,
"chunk write error"
)
switch
{
case
errors
.
Is
(
err
,
postage
.
ErrBucketFull
)
:
jsonhttp
.
PaymentRequired
(
w
,
"batch is overissued"
)
default
:
jsonhttp
.
InternalServerError
(
w
,
"chunk write error"
)
}
return
}
else
if
len
(
seen
)
>
0
&&
seen
[
0
]
&&
tag
!=
nil
{
err
:=
tag
.
Inc
(
tags
.
StateSeen
)
...
...
pkg/api/dirs.go
View file @
16551b8d
...
...
@@ -23,6 +23,7 @@ import (
"github.com/ethersphere/bee/pkg/jsonhttp"
"github.com/ethersphere/bee/pkg/logging"
"github.com/ethersphere/bee/pkg/manifest"
"github.com/ethersphere/bee/pkg/postage"
"github.com/ethersphere/bee/pkg/sctx"
"github.com/ethersphere/bee/pkg/storage"
"github.com/ethersphere/bee/pkg/swarm"
...
...
@@ -86,7 +87,12 @@ func (s *server) dirUploadHandler(w http.ResponseWriter, r *http.Request, storer
if
err
!=
nil
{
logger
.
Debugf
(
"bzz upload dir: store dir err: %v"
,
err
)
logger
.
Errorf
(
"bzz upload dir: store dir"
)
switch
{
case
errors
.
Is
(
err
,
postage
.
ErrBucketFull
)
:
jsonhttp
.
PaymentRequired
(
w
,
"batch is overissued"
)
default
:
jsonhttp
.
InternalServerError
(
w
,
errDirectoryStore
)
}
return
}
if
created
{
...
...
pkg/api/pss.go
View file @
16551b8d
...
...
@@ -8,6 +8,7 @@ import (
"context"
"crypto/ecdsa"
"encoding/hex"
"errors"
"io/ioutil"
"net/http"
"strings"
...
...
@@ -96,7 +97,12 @@ func (s *server) pssPostHandler(w http.ResponseWriter, r *http.Request) {
if
err
!=
nil
{
s
.
logger
.
Debugf
(
"pss send payload: %v. topic: %s"
,
err
,
topicVar
)
s
.
logger
.
Error
(
"pss send payload"
)
switch
{
case
errors
.
Is
(
err
,
postage
.
ErrBucketFull
)
:
jsonhttp
.
PaymentRequired
(
w
,
"batch is overissued"
)
default
:
jsonhttp
.
InternalServerError
(
w
,
nil
)
}
return
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment