feat: 🎸 Add more logging for desktop client (#2344)
This commit is contained in:
1 parent
c177abb978
commit
355ebb12db
4 files changed
+12
-7
No files matched your search
@@ -85,8 +85,6 @@ export default class ScopesScopeProjectsRoute extends Route {
|
||||
try {
|
||||
sessions = await this.clientAgentSessions.getNewSessionsWithCredentials();
|
||||
} catch (e) {
|
||||
// TODO: Log this error
|
||||
|
||||
// If we're unauthenticated, try and re-authenticate
|
||||
if (e.statusCode === 401 || e.statusCode === 403) {
|
||||
const sessionData = this.session.data?.authenticated;
|
||||
@@ -99,13 +97,15 @@ export default class ScopesScopeProjectsRoute extends Route {
|
||||
token,
|
||||
});
|
||||
this.job.start();
|
||||
__electronLog?.info('Starting polling of new sessions again');
|
||||
return;
|
||||
} catch (e) {
|
||||
// TODO: Log this error
|
||||
__electronLog?.error('Failed to add token to daemons', e);
|
||||
// If it fails again, just let the poller be killed
|
||||
}
|
||||
}
|
||||
|
||||
__electronLog?.error('Failed to get new Sessions', e);
|
||||
if (this.job) {
|
||||
this.flashMessages.danger(
|
||||
this.intl.t('errors.client-agent-failed.sessions'),
|
||||
@@ -118,6 +118,7 @@ export default class ScopesScopeProjectsRoute extends Route {
|
||||
|
||||
// Kill the poller if we get an error
|
||||
this.job.stop();
|
||||
__electronLog?.info('Stopping polling of new sessions');
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
@@ -39,7 +39,11 @@ export default class ScopesScopeProjectsSessionsSessionRoute extends Route {
|
||||
(cred) => session.addCredential(cred),
|
||||
);
|
||||
} catch (e) {
|
||||
// TODO: Log this error
|
||||
__electronLog?.error(
|
||||
'Failed to fetch credentials from client agent',
|
||||
e,
|
||||
);
|
||||
|
||||
this.flashMessages.danger(
|
||||
this.intl.t('errors.client-agent-failed.sessions'),
|
||||
{
|
||||
|
||||
@@ -143,8 +143,8 @@ export default class ScopesScopeProjectsTargetsIndexRoute extends Route {
|
||||
|
||||
try {
|
||||
await aliasPromise;
|
||||
} catch {
|
||||
// TODO: Log this error
|
||||
} catch (e) {
|
||||
__electronLog?.warn('Could not retrieve aliases for targets', e);
|
||||
// Separately await and catch the error here so we can continue loading
|
||||
// the page in case the controller doesn't support aliases yet
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ const jsonify = (data) => {
|
||||
try {
|
||||
return JSON.parse(data);
|
||||
} catch (e) {
|
||||
log.error('jsonify:', e);
|
||||
log.warn('jsonify:', e);
|
||||
// Ignore parse errors
|
||||
}
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user