mirror of
https://github.com/sasjs/adapter.git
synced 2026-01-05 11:40:06 +00:00
feat: improved error message for requests related to tokens operations
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import { prefixMessage } from '@sasjs/utils/error'
|
||||
import { RequestClient } from '../request/RequestClient'
|
||||
import { getTokenRequestErrorPrefix } from './getTokenRequestErrorPrefix'
|
||||
import { ServerType } from '@sasjs/utils'
|
||||
|
||||
/**
|
||||
* Exchanges the auth code for an access token for the given client.
|
||||
@@ -31,6 +33,16 @@ export async function getAccessTokenForSasjs(
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
throw prefixMessage(err, 'Error while getting access token. ')
|
||||
throw prefixMessage(
|
||||
err,
|
||||
getTokenRequestErrorPrefix(
|
||||
'fetching access token',
|
||||
'getAccessTokenForSasjs',
|
||||
ServerType.Sasjs,
|
||||
url,
|
||||
data,
|
||||
clientId
|
||||
)
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user