Skip to content

Commit

Permalink
🐛 Extra error handling for if user has incorrect server url (actualbu…
Browse files Browse the repository at this point in the history
…dget#3736)

* adding some safety for if user has incorrect server url format

* added additional error handling for when incorrect server url has been setup

* good rabbit
  • Loading branch information
MikesGlitch authored Oct 26, 2024
1 parent f25dc1f commit a6da06a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
23 changes: 16 additions & 7 deletions packages/loot-core/src/server/server-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,22 @@ export function setServer(url: string): void {
// `url` is optional; if not given it will provide the global config
export function getServer(url?: string): ServerConfig | null {
if (url) {
return {
BASE_SERVER: url,
SYNC_SERVER: joinURL(url, '/sync'),
SIGNUP_SERVER: joinURL(url, '/account'),
GOCARDLESS_SERVER: joinURL(url, '/gocardless'),
SIMPLEFIN_SERVER: joinURL(url, '/simplefin'),
};
try {
return {
BASE_SERVER: url,
SYNC_SERVER: joinURL(url, '/sync'),
SIGNUP_SERVER: joinURL(url, '/account'),
GOCARDLESS_SERVER: joinURL(url, '/gocardless'),
SIMPLEFIN_SERVER: joinURL(url, '/simplefin'),
};
} catch (error) {
console.warn(
'Unable to parse server URL - using the global config.',
{ config },
error,
);
return config;
}
}
return config;
}
6 changes: 6 additions & 0 deletions upcoming-release-notes/3736.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
category: Bugfix
authors: [MikesGlitch]
---

Add extra error handling for when an incorrect server URL has been setup

0 comments on commit a6da06a

Please sign in to comment.