@@ -49,7 +49,7 @@ func (c *client) SessionCreate(ctx context.Context, session requests.SessionCrea
4949 SetBody (session ).
5050 Post (c .config .APIBaseURL + "/internal/sessions" )
5151
52- return NewError (resp , err )
52+ return HasError (resp , err )
5353}
5454
5555func (c * client ) SessionAsAuthenticated (ctx context.Context , uid string ) error {
@@ -62,7 +62,7 @@ func (c *client) SessionAsAuthenticated(ctx context.Context, uid string) error {
6262 }).
6363 Patch (c .config .APIBaseURL + "/internal/sessions/{uid}" )
6464
65- return NewError (resp , err )
65+ return HasError (resp , err )
6666}
6767
6868func (c * client ) FinishSession (ctx context.Context , uid string ) error {
@@ -72,7 +72,7 @@ func (c *client) FinishSession(ctx context.Context, uid string) error {
7272 SetPathParam ("uid" , uid ).
7373 Post (c .config .APIBaseURL + "/internal/sessions/{uid}/finish" )
7474
75- return NewError (resp , err )
75+ return HasError (resp , err )
7676}
7777
7878func (c * client ) KeepAliveSession (ctx context.Context , uid string ) error {
@@ -82,7 +82,7 @@ func (c *client) KeepAliveSession(ctx context.Context, uid string) error {
8282 SetPathParam ("uid" , uid ).
8383 Post (c .config .APIBaseURL + "/internal/sessions/{uid}/keepalive" )
8484
85- return NewError (resp , err )
85+ return HasError (resp , err )
8686}
8787
8888func (c * client ) UpdateSession (ctx context.Context , uid string , model * models.SessionUpdate ) error {
@@ -95,7 +95,7 @@ func (c *client) UpdateSession(ctx context.Context, uid string, model *models.Se
9595 SetBody (model ).
9696 Patch (c .config .APIBaseURL + "/internal/sessions/{tenant}" )
9797
98- return NewError (res , err )
98+ return HasError (res , err )
9999}
100100
101101func (c * client ) EventSessionStream (ctx context.Context , uid string ) (* websocket.Conn , error ) {
@@ -113,7 +113,7 @@ func (c *client) EventSessionStream(ctx context.Context, uid string) (*websocket
113113 nil ,
114114 )
115115 if err != nil {
116- return nil , NewError (nil , err )
116+ return nil , HasError (nil , err )
117117 }
118118
119119 return connection , nil
@@ -128,8 +128,8 @@ func (c *client) SaveSession(ctx context.Context, uid string, seat int) error {
128128 "seat" : strconv .Itoa (seat ),
129129 }).
130130 Post (c .config .EnterpriseBaseURL + "/internal/sessions/{uid}/records/{seat}" )
131- if HasError (resp , err ) {
132- return NewError ( resp , err )
131+ if err := HasError (resp , err ); err != nil {
132+ return err
133133 }
134134
135135 if resp .StatusCode () == http .StatusNotAcceptable {
@@ -143,5 +143,5 @@ func (c *client) SaveSession(ctx context.Context, uid string, seat int) error {
143143 return nil
144144 }
145145
146- return NewError (resp , err )
146+ return HasError (resp , err )
147147}
0 commit comments