fix: returning undefined when URL is not valid (#6377)
* fix: returning undefined when URL is not valid This can happen when the user is typing, and once it was set there was no way of changing it. * adding change set
This commit is contained in:
1 parent
f3adf68775
commit
3c21d2be1f
5 files changed
+21
-8
No files matched your search
@@ -24,7 +24,11 @@ export async function refreshRequestyModels(controller: Controller, _: EmptyRequ
|
||||
const baseUrl = controller.stateManager.getGlobalSettingsKey("requestyBaseUrl")
|
||||
|
||||
const resolvedUrl = toRequestyServiceUrl(baseUrl)
|
||||
const url = new URL(`${resolvedUrl.pathname}/models`, resolvedUrl).toString()
|
||||
const url = resolvedUrl != null ? new URL(`${resolvedUrl.pathname}/models`, resolvedUrl).toString() : undefined
|
||||
|
||||
if (url == null) {
|
||||
throw new Error("URL is not valid.")
|
||||
}
|
||||
|
||||
const headers = {
|
||||
Authorization: `Bearer ${apiKey}`,
|
||||
|
||||
Reference in new issue
Block a user