Skip to content

Commit

Permalink
Refactor console.error usages in middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-tavares committed Jun 10, 2021
1 parent 2730ec8 commit 6aca956
Showing 1 changed file with 11 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ import { ServerReturnedEndpointPackageInfo } from './action';

type EndpointPageStore = ImmutableMiddlewareAPI<EndpointState, AppAction>;

// eslint-disable-next-line no-console
const logError = console.error;

export const endpointMiddlewareFactory: ImmutableMiddlewareFactory<EndpointState> = (
coreStart,
depsStart
Expand Down Expand Up @@ -154,8 +157,7 @@ export const endpointMiddlewareFactory: ImmutableMiddlewareFactory<EndpointState
}
} catch (error) {
// Ignore Errors, since this should not hinder the user's ability to use the UI
// eslint-disable-next-line no-console
console.error(error);
logError(error);
}
} catch (error) {
dispatch({
Expand Down Expand Up @@ -275,8 +277,7 @@ export const endpointMiddlewareFactory: ImmutableMiddlewareFactory<EndpointState
}
} catch (error) {
// Ignore Errors, since this should not hinder the user's ability to use the UI
// eslint-disable-next-line no-console
console.error(error);
logError(error);
}
} catch (error) {
dispatch({
Expand Down Expand Up @@ -321,8 +322,7 @@ export const endpointMiddlewareFactory: ImmutableMiddlewareFactory<EndpointState
}
} catch (error) {
// Ignore Errors, since this should not hinder the user's ability to use the UI
// eslint-disable-next-line no-console
console.error(error);
logError(error);
}
} catch (error) {
dispatch({
Expand Down Expand Up @@ -456,10 +456,8 @@ const endpointsTotal = async (http: HttpStart): Promise<number> => {
})
).total;
} catch (error) {
// eslint-disable-next-line no-console
console.error(`error while trying to check for total endpoints`);
// eslint-disable-next-line no-console
console.error(error);
logError(`error while trying to check for total endpoints`);
logError(error);
}
return 0;
};
Expand All @@ -468,10 +466,8 @@ const doEndpointsExist = async (http: HttpStart): Promise<boolean> => {
try {
return (await endpointsTotal(http)) > 0;
} catch (error) {
// eslint-disable-next-line no-console
console.error(`error while trying to check if endpoints exist`);
// eslint-disable-next-line no-console
console.error(error);
logError(`error while trying to check if endpoints exist`);
logError(error);
}
return false;
};
Expand Down Expand Up @@ -530,7 +526,6 @@ async function getEndpointPackageInfo(
});
} catch (error) {
// Ignore Errors, since this should not hinder the user's ability to use the UI
// eslint-disable-next-line no-console
console.error(error);
logError(error);
}
}

0 comments on commit 6aca956

Please sign in to comment.