mirror of
https://github.com/sasjs/adapter.git
synced 2026-01-17 17:10:05 +00:00
chore(session-manager): renamed ErrorResponse interface to ApiErrorResponse
This commit is contained in:
@@ -6,7 +6,7 @@ import { RequestClient } from './request/RequestClient'
|
|||||||
|
|
||||||
const MAX_SESSION_COUNT = 1
|
const MAX_SESSION_COUNT = 1
|
||||||
|
|
||||||
interface ErrorResponse {
|
interface ApiErrorResponse {
|
||||||
response: { status: number | string; data: { message: string } }
|
response: { status: number | string; data: { message: string } }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -164,7 +164,7 @@ export class SessionManager {
|
|||||||
* @returns - an error message.
|
* @returns - an error message.
|
||||||
*/
|
*/
|
||||||
private getErrorMessage(
|
private getErrorMessage(
|
||||||
err: ErrorResponse,
|
err: ApiErrorResponse,
|
||||||
url: string,
|
url: string,
|
||||||
method: 'GET' | 'POST' | 'DELETE'
|
method: 'GET' | 'POST' | 'DELETE'
|
||||||
) {
|
) {
|
||||||
@@ -189,7 +189,7 @@ export class SessionManager {
|
|||||||
.then(() => {
|
.then(() => {
|
||||||
this.sessions = this.sessions.filter((s) => s.id !== id)
|
this.sessions = this.sessions.filter((s) => s.id !== id)
|
||||||
})
|
})
|
||||||
.catch((err: ErrorResponse) => {
|
.catch((err: ApiErrorResponse) => {
|
||||||
throw prefixMessage(
|
throw prefixMessage(
|
||||||
this.getErrorMessage(err, url, 'DELETE'),
|
this.getErrorMessage(err, url, 'DELETE'),
|
||||||
'Error while deleting session. '
|
'Error while deleting session. '
|
||||||
@@ -258,7 +258,7 @@ export class SessionManager {
|
|||||||
|
|
||||||
const { result: createdSession, etag } = await this.requestClient
|
const { result: createdSession, etag } = await this.requestClient
|
||||||
.post<Session>(url, {}, accessToken)
|
.post<Session>(url, {}, accessToken)
|
||||||
.catch((err: ErrorResponse) => {
|
.catch((err: ApiErrorResponse) => {
|
||||||
throw prefixMessage(
|
throw prefixMessage(
|
||||||
this.getErrorMessage(err, url, 'POST'),
|
this.getErrorMessage(err, url, 'POST'),
|
||||||
`Error while creating session. `
|
`Error while creating session. `
|
||||||
@@ -287,7 +287,7 @@ export class SessionManager {
|
|||||||
.get<{
|
.get<{
|
||||||
items: Context[]
|
items: Context[]
|
||||||
}>(url, accessToken)
|
}>(url, accessToken)
|
||||||
.catch((err: ErrorResponse) => {
|
.catch((err: ApiErrorResponse) => {
|
||||||
throw prefixMessage(
|
throw prefixMessage(
|
||||||
this.getErrorMessage(err, url, 'GET'),
|
this.getErrorMessage(err, url, 'GET'),
|
||||||
`Error while getting list of contexts. `
|
`Error while getting list of contexts. `
|
||||||
|
|||||||
Reference in New Issue
Block a user