Fix to parse API error

This commit is contained in:
178inaba 2017-04-19 14:32:53 +09:00
parent fe02b9e6af
commit aa0f9563ac
4 changed files with 21 additions and 7 deletions

View file

@ -3,7 +3,6 @@ package mastodon
import (
"context"
"encoding/json"
"fmt"
"net/http"
"net/url"
"path"
@ -64,7 +63,7 @@ func RegisterApp(ctx context.Context, appConfig *AppConfig) (*Application, error
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
return nil, fmt.Errorf("bad request: %v", resp.Status)
return nil, parseAPIError("bad request", resp)
}
var app Application